public void WriteTo(UnityEventBase obj, Dictionary <long, UnityObject> objects, IIDMap idMap) { if (obj == null) { return; } if (m_calls == null) { return; } object persistentCalls = Activator.CreateInstance(m_persistentCallGroupInfo.FieldType); object calls = Activator.CreateInstance(m_callsInfo.FieldType); IList list = (IList)calls; for (int i = 0; i < m_calls.Length; ++i) { PersistentPersistentCall persistentCall = m_calls[i]; if (persistentCall != null) { object call = Activator.CreateInstance(m_callType); persistentCall.WriteTo(call, objects); list.Add(call); } else { list.Add(null); } } m_callsInfo.SetValue(persistentCalls, calls); m_persistentCallGroupInfo.SetValue(obj, persistentCalls); }
protected override object WriteToImpl(object obj) { obj = base.WriteToImpl(obj); if (obj == null) { return(null); } if (m_calls == null) { return(obj); } object persistentCalls = Activator.CreateInstance(m_persistentCallGroupInfo.FieldType); object calls = Activator.CreateInstance(m_callsInfo.FieldType); IList list = (IList)calls; for (int i = 0; i < m_calls.Length; ++i) { PersistentPersistentCall persistentCall = m_calls[i]; if (persistentCall != null) { object call = Activator.CreateInstance(m_callType); persistentCall.WriteTo(call); list.Add(call); } else { list.Add(null); } } m_callsInfo.SetValue(persistentCalls, calls); m_persistentCallGroupInfo.SetValue(obj, persistentCalls); return(obj); }