UnityActions causing NRE

Issue #178 resolved
Former user created an issue
  1. Created a class with the following:
[Tooltip("Called when an object enters the trigger.")]
    public UnityAction<Collider> onTriggerEnter;

The component inspector doesn't render and I get the following error:

The following exception was thrown when drawing property onTriggerExit with the following chain of property value drawers: 
PropertyContextMenuDrawer<UnityAction<Collider>>, ReferenceDrawer<UnityAction<Collider>>, FixUnityNullDrawer<UnityAction<Collider>>, TooltipAttributeDrawer, DelegateDrawer<UnityAction<Collider>>, ReferencePathConflictDrawer<UnityAction<Collider>>, ReferenceValueConflictDrawer<UnityAction<Collider>>, NullableReferenceDrawer<UnityAction<Collider>>.
UnityEngine.Debug:LogError(Object)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:453)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:360)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/InspectorUtilities.cs:338)
Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean) (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:158)
Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at C:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:195)
UnityEditor.DockArea:OnGUI()
  1. Add the same code to any class. Open unity.

  2. Wouldn't help.

  3. Version 5.6.2f1.

  4. 1.0.5.0 (Instruction on the issue reporting is wrong. Odin is in tools menu)

  5. Windows 7 64 bit

Comments (4)

  1. Tor Esa Vestergaard
    • changed status to open

    Thanks for reporting this - just replicated it, and I'll take a look at it promptly :)

  2. Lucas montenegro carvalhaes

    Sorry, accidentally reported anonymously. I'm having the problem. (posting just to get notifications).

  3. Tor Esa Vestergaard

    Alright, I've fixed this issue. Do note that you will have to use Odin's serialization (IE, derive from SerializedMonoBehaviour, etc) in order to see it in the inspector and have it be persisted, since Unity will not serialize it on its own.

    If you'd like a build with the hotfix included, please send me a mail with your Odin invoice id at tor@sirenix.net, and I will send you a build immediately :)

  4. Log in to comment