[GenerateAuthoringComponent] on 0.17.0-preview.41 does not support ISharedComponentData anymore

[GenerateAuthoringComponent] on 0.17.0-preview.41 does not support ISharedComponentData anymore

I can replicate 2 different error msgs even.

ArmySharedData.cs(13,9): error ArmySharedData.cs(13,9): error DC3003: ArmySharedData has the [GenerateAuthoringComponent] attribute, and must therefore implement either the IComponentData interface or the IBufferElementData interface.

for:

    [Serializable]
    [GenerateAuthoringComponent]
    public struct ArmySharedData : ISharedComponentData, IEquatable<ArmySharedData>
    {
        public int FactionId;

        public bool Equals(ArmySharedData other)
        {
            return FactionId == other.FactionId;
        }

        public override bool Equals(object obj)
        {
            return obj is ArmySharedData other && Equals(other);
        }

        public override int GetHashCode()
        {
            return FactionId;
        }
    }

and:

(0,0): error error DC3003: ArmySharedData has the [GenerateAuthoringComponent] attribute, and must therefore implement either the IComponentData interface or the IBufferElementData interface.

for:

    [Serializable]
    [GenerateAuthoringComponent]
    public struct ArmySharedData : ISharedComponentData
    {
        public int FactionId;
    }

This seems to be a regression since it is not mentioned in the changelogs.

The DC300X static analysis rules were added in 0.17.

I had a read through their documentation and change logs and I could only see it mentioned working for IComponentData and IBufferElement so I’m not sure it was ever supported, even if it happened to work.

1 Like

Thx tertle.

Probably worth noting that recently updating the package i even found that i was not using the [GenerateAuthoringComponent] workflow with ISharedComponentData in the Unity Editor anymore (or even ever) and all usage was only form code.
Just deleting [GenerateAuthoringComponent] from ISharedComponentData now. So this workflow seems to be unsupported before 0.17 to me but not detected as an error. Which changed with version 0.17