[field: SerializedProperty] not affected by any other attributes

Issue #945 invalid
Lukas Tomondy created an issue

When you create a property field:

then attributes like [Title] are ignored and not displayed in the inspector. However the fields are serialized correctly and displayed.

However [Tooltip] works, so does stuff like [BoxGroup] (sometimes not even this). So this means mainly [Title] is not working and we cannot divide categories into titles.

Comments (2)

  1. Antonio Rafael Antunes Miranda

    If you use [field: SerializeField], you're serializing the property's backing field. What you see in the inspector is actually this backing field, not the property itself. When you add an attribute like [Title("Some Title")], you're applying it to the property, not the backing field. Since the inspector displays the backing field, the title attribute won't take effect. To apply attributes effectively, you'll need to attach them to the backing field as well, like [field: Title("Some Title")].

  2. Log in to comment