Using enums in ComponentData

Hello everyone,

I would like to use this ISharedComponentData

public struct UnitType : ISharedComponentData
{
    public enum Type {Base, CloseOne, CloseTwo, CloseThree, RangedOne, RangedTwo, RangedThree, RogueOne, RogueTwo, RogueThree};
}

and set it to an entitiy (the adding is happening in another script which works fine),

EntityManager.SetSharedComponentData<UnitType>(unitQuery[j], new UnitType { UnitType.Type = UnitType.Type.Base });

what results in this error message:

Do you know what is wrong here?

The error means you need to place the enum initialization outside of the SCD. Inside you just need to have public Type
type. I dont mess with SCDs much at all except for mesh renderers, but I think Whatever you set UnitType to will be the same for all Units. Hopefully some of the smart folks here will make it clear for you though

Thank you bekpsmith, it works now!