Search Unity

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

Discussion in 'Entity Component System' started by Rob-A, Apr 4, 2021.

  1. Rob-A

    Rob-A

    Joined:
    Aug 7, 2012
    Posts:
    33
    [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:

    Code (CSharp):
    1.     [Serializable]
    2.     [GenerateAuthoringComponent]
    3.     public struct ArmySharedData : ISharedComponentData, IEquatable<ArmySharedData>
    4.     {
    5.         public int FactionId;
    6.  
    7.         public bool Equals(ArmySharedData other)
    8.         {
    9.             return FactionId == other.FactionId;
    10.         }
    11.  
    12.         public override bool Equals(object obj)
    13.         {
    14.             return obj is ArmySharedData other && Equals(other);
    15.         }
    16.  
    17.         public override int GetHashCode()
    18.         {
    19.             return FactionId;
    20.         }
    21.     }
    and:

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

    for:

    Code (CSharp):
    1.     [Serializable]
    2.     [GenerateAuthoringComponent]
    3.     public struct ArmySharedData : ISharedComponentData
    4.     {
    5.         public int FactionId;
    6.     }
    7.  
    This seems to be a regression since it is not mentioned in the changelogs.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    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.
     
    Rob-A likes this.
  3. Rob-A

    Rob-A

    Joined:
    Aug 7, 2012
    Posts:
    33
    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