OnInspectorInit attribute does not run when placed above a Method or Property.

Issue #674 resolved
Scion created an issue

1. What happened?

The OnInspectorInit attribute does not work when placed over Properties or Methods.

2. How can we reproduce it?

Place an OnInspectorInit over a property or method, such as in the code snippet below.

3. If screenshots would help explain or demonstrate your issue, please include these.

See code snippet.

4. What version of Unity are you using?

2019.4.0f1

5. What version of Odin are you using? (See "Tools > Odin Inspector > About")

3.0.0.1

6. Do you have Editor Only mode enabled?

Yes

7. What operating system are you on?

Windows 10

[CreateAssetMenu(fileName = nameof(UIItemGroupInfo), menuName = nameof(UIItemGroupInfo))]
//Works
[OnInspectorInit(nameof(LoadItemInfos))]
public class UIItemGroupInfo : ScriptableObject
{
    //Works
    [OnInspectorInit(nameof(LoadItemInfos))]
    public int test;

    //Does not work
    [OnInspectorInit(nameof(LoadItemInfos))]
    public int testProp { get; set; }

    //Does not work
    [OnInspectorInit(nameof(LoadItemInfos))]
    void LoadItemInfos()
    {
        Debug.Log("INIT");
    }
}

Comments (4)

  1. Log in to comment