Serialized UnityEvents lose the references of what was set on them

Issue #323 invalid
Anonymous created an issue

For Odin Version 1.0.6.5

Steps to reproduce: 1. Create a MonoBehaviour with the code below. 2. Go to Unity so that the code is compiled. 3. Add some stuff to some of the events in the inspector. 4. Go to the code and change or add a UnityEvent variable. 5. Go back to unity to recompile 6. Confusion.

For some reason some of the functions being added to the events are being lost upon recompilation. What am I doing wrong? Shouldn't variables of the same type retain the inspector references and information after a name change?

They also lose references when simply adding new variables to the code.

        public enum MTActionType { TurnOn, TurnOff };
    [TabGroup("ParentGroup", "StateEvents")]
    public bool a;
    [TabGroup("ParentGroup", "ProgressEvents")]
    public bool b;

    [TabGroup("ParentGroup/StateEvents/InnerGroup","OnActivated")] 
    public UnityEvent activationActions;
    [TabGroup("ParentGroup/StateEvents/InnerGroup","OnDeactivated")] 
    public UnityEvent deactivationActions;
    [TabGroup("ParentGroup/StateEvents/InnerGroup","OnStarted")]
    public UnityEvent StartActions;
    [TabGroup("ParentGroup/StateEvents/InnerGroup","OnCanceled")] 
    public UnityEvent CancelActions;
    [TabGroup("ParentGroup/StateEvents/InnerGroup","OnCompleted")] 
    public UnityEvent CompletedActions;
    [TabGroup("ParentGroup/StateEvents/InnerGroup","OnFailed")] 
    public UnityEvent FailedActions;
    [TabGroup("ParentGroup/ProgressEvents/InnerGroup","IsUnfinished")]
    public UnityEvent Unfinished;
    [TabGroup("ParentGroup/ProgressEvents/InnerGroup","IsFinished")]
    public UnityEvent Finished;

Comments (2)

  1. Tor Esa Vestergaard

    This issue isn't very well explained - as far as I can tell, this is all working as intended. These fields are even serialized by Unity, and not Odin. Until some reproduction steps showing a clear Odin-related error show up, I'm marking this as invalid.

  2. Log in to comment