Skip to content

Latest commit

 

History

History
22 lines (19 loc) · 640 Bytes

tutorial-netcodecharacters-ghostfields-firstperson.md

File metadata and controls

22 lines (19 loc) · 640 Bytes

You'll need to make the FirstPersonPlayer a ghost component and synchronize the ControlledCharacter field. This will ensure that the entity references set up by the server when instantiating a character will be carried over to clients:

[GhostComponent]
public struct FirstPersonPlayer : IComponentData
{
    [GhostField]
    public Entity ControlledCharacter;
}

Then, make FirstPersonCharacterComponent a ghost component and synchronize the ViewPitchDegrees field:

[GhostComponent]
public struct FirstPersonCharacterComponent : IComponentData
{
    // ...

    [GhostField]
    public float ViewPitchDegrees;
}