[ShowIf] Attribute not respected on property with reference copy.

Issue #735 new
Nicholas Aitken created an issue


Windows 10 / Unity 2020.2.0f1

I have outlined exactly how to reproduce it below including code and video screen capture. I have noted that it applies to SerializedScriptableObject and ShowIf attribute, but it could be more broadly applicable (e.g. to Monobehaviours and other attributes).

Description: When a class has a [ShowIf] attribute, and a ScriptableObject includes two properties (e.g. 'myObject' and 'myReferenceCopy'), one of which is a reference to the other (e.g. 'myReferenceCopy = myObject'), then in the Inspector, the [ShowIf] attribute is not respected on the reference copy (e.g. 'myReferenceCopy'). See example code and screen capture below:

using Sirenix.OdinInspector;

public class TestSO : SerializedScriptableObject
    public MyClass myObject;
    public MyClass myReferenceCopy;

    private void OnEnable()
        myReferenceCopy = myObject;

public class MyClass
    public bool showIt;

    public int myInt;

Video screen capture (GIF) is attached.

Comments (2)

  1. Log in to comment