I have serializable dictionary, and I try to add unity event on normal mode, but the reference for that event is loss after entering play mode.
Basically what i try to achieve here is, I add new unity event with script in a dictionary and also list, so basically the unity event in the list are the reference from the dictionary. but once i enter play mode, the unity event are not the same instance anymore.
It took me more than 3 days of research about serializable dictionary after i decide to ask question here.
OnBegin is serializable dictionary that i inherit from SerializableDictionary<int, UnityEvent>.
OnBeginExpose is normal serializable list.
[SerializeField]
public MyDictionaryEntry OnBegin = new MyDictionaryEntry();
[SerializeField]
public List<UnityEvent> OnBeginExpose = new List<UnityEvent>();
This is how i try to add the unity event dynamically.
[System.Serializable]
public class CaptionEvent : UnityEvent{};
Dynamically add unity event with custom editor
CaptionEvent newEvent = new CaptionEvent();
eventsAuto.OnBegin.Add(i, newEvent);
eventsAuto.OnBeginExpose.Add(newEvent);
I heard about Object.GetInstanceID() that might be a solution, but i have no idea how it works. Anyone have good reference for above issues ?

