Odin Cannot "see" a type, this leads to rendering issues; Unity renders it fine.

Issue #740 resolved
Thygrrr created an issue

I have a Generic ScriptableObject type, used in a Generic MonoBehaviour, and that causes Rendering errors in Implementors/Descendants.

Unity 2020.2 draws the property fine.

Odin cannot draw it, and actually it must be in its blind spot (see what I did there?) because it will also ignore any Attributes above it (such as [InfoBox]) and [DrawWithUnity].

A workaround is to disable the concrete implementor type in the Preferences, but the problem is, new inheritors will be enabled.

I can disable the entire Namespace, but only if the Namespace contains at least one other, “visible” type.

[OdinDontRegister] doesn’t work on the Generic Supertype and it also doesn’t work on the Implementor type. 😞 It also doesn’t work with the Property type (DataChannel<T>).

Reproduction

I attached a minimal example.

Add the folder contents to the root of Assets (4 scripts). Create a GameObject and add the

OdinDoesntCorrectlyDrawThisBehaviour

to it.

  1. Observe its inspector:

    1. Then turn off Odin Inspector, observe the changes.

Corresponding Code is in DataChannelAction.cs

        [Header("Thank you for turning Odin off.")]
        [InfoBox("This box doesn't even render.", InfoMessageType.Info)]
        [DrawWithUnity] //FIXME: Odin needs to fix this at least :)
        public DataChannel<T> channel;
        [InfoBox("The Property above this box is missing.\nAnother box above also doesn't show.\nTurn off Odin to see.", InfoMessageType.Error)]

Comments (4)

  1. Tor Esa Vestergaard

    This issue has been fixed in 3.0.4 which will release later this month. If you would like a fix earlier, feel free to contact me on Discord and I'll send you a preview build with the fix included.

    The issue was that Odin incorrectly considered generic Unity object references to not be serializable by Unity, which they were made in version 2020.1. Our serialization logic has now been updated to reflect this change when Odin runs in Unity 2020.1+.

  2. Log in to comment