C# Custom attribute with another attribute automatically linked?

Hey all,

Created myself a custom attribute in C# to help with some editor tools I’m building. This particular attribute always requires Unity’s [SerializeField] attribute and I was wondering if anyone has found a way to directly include an attribute to a custom attribute, so I can just use the single property attribute instead of requiring both the custom attribute and the existing one.

Thanks in advance as always! :smile:

It both is and isn’t possible here.

Yes you can decorate attributes with more attributes and read those attributes. Odin Inspector does this for a few things.

However serialisation happens before inspectors are drawn, so serialisation attributes can’t be used in this manner as it’s too late for them to be used at that point.

Don’t know if it will work (probably won’t), maybe try to make your attribute inherits from SerializeField ?

Edit: No it won’t, SerializeField is sealed.