Skip to content

ShowInInspector: Range attribute not evaluated for sub-fields #186

Open
@breeky-dev

Description

@breeky-dev

Describe the bug
When using the ShowInInspector attribute on a reference type, the type sub fields attribute do not work correctly.

Expected behavior
In the code sample below, the int field 'MyInt' is not displayed with a slider as expected.

Code Sample

    public class AttributeTester : MonoBehaviour
    {
        [SerializeReference]
        public A a;
        
        [ShowInInspector]
        public A PropertyA
        {
            get => a;
            set => a = value;
        }
    }

    [Serializable]
    public class A
    {
        [Range(0, 10)]
        public int MyInt;
    }

Screenshots

Image

Desktop: Windows 11
Unity version: 6
Tri Inspector version: 1.14.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions