Odin can draw only one UnityEvent in the Inspector, if there is more than one instance of the same script

Issue #284 resolved
Former user created an issue

Gif : https://imgur.com/a/MD5bX

I have script with a UnityEvent field. If in a GameObject, I add two (or more) of that script, all of them draw the same UnityEvent field, that is the one of latest added.

Steps to reproduce :

  • Create a script, with a field of type UnityEvent
  • Add the script to a GameObject
  • Add some listeners in the UnityEvent
  • Add another instance of the same script
  • Add some listeners too

If you disable Odin, the fields are drawn normally.

Unity 2017.3.0f3 Odin Windows 10 (latest update)

Comments (4)

  1. Bjarke Elias
    • changed status to open

    Thanks for the report. Good one to catch.

    We'll take another good look at UnityEvents, as that is not the only issue we have with them currently, maybe this bug will help us with the other bugs as well. For now, you can fix it by placing this script in an editor folder:

        [DrawerPriority(0, 0, 1.01)]
        public class UnityUnityEventDrawer<T> : DrawWithUnityBaseDrawer<T> 
            where T : UnityEventBase
            protected override void DrawPropertyLayout(IPropertyValueEntry<T> entry, GUIContent label)
                if (entry.SerializationBackend == SerializationBackend.Unity)
                    base.DrawPropertyLayout(entry, label);
                    this.CallNextDrawer(entry, label);
  2. Log in to comment