Type or namespace could not be found GhostDefaultFile - Unity.Netcode

Hi all,

following the documentation at Getting started with NetCode | Unity NetCode | 0.0.4-preview.0

Specifically stopped at the part where

using Unity.Entities;
using Unity.NetCode;

[GenerateAuthoringComponent]
public struct MovableCubeComponent : IComponentData
{
    [GhostDefaultField]
    public int PlayerId;
}

is supposed to be added as a component.
When I open this in VS / VScode i get errors that ‘Type or namespace could not be found’. I’m not sure I know what i’m doing wrong . I checked the references in Assembly-CSharp and I know that ‘Unity.NetCode’ is added.

In the file Unity.NetCode is suggested to be an unnecessary using directive. Can anyone tell me what they think is going on? Thanks

It loos like you’re using the NetCode version 0.0.4 getting started – if you’re on a later version, here’s the 0.3 one: https://docs.unity3d.com/Packages/com.unity.netcode@0.3/manual/getting-started.html (for some reason 0.4 is not up yet)

From 0.3 onwards, [GhostDefaultField] is called [GhostField].

1 Like

Yes, this worked. Thanks!

1 Like