private void OnDestroyed(ExposeToEditor obj) { if (m_editor.IsPlaying) { obj.SendMessage("OnRuntimeDestroy", SendMessageOptions.DontRequireReceiver); m_playModeCache.Remove(obj); } else { obj.SendMessage("OnEditorDestroy", SendMessageOptions.DontRequireReceiver); if (m_editModeCache.Contains(obj)) { m_editModeCache.Remove(obj); TryToDestroyColliders(obj); } } if (m_editor.Selection.IsSelected(obj.gameObject)) { m_editor.Selection.objects = m_editor.Selection.objects.Where(o => o != obj.gameObject).ToArray(); } if (Destroyed != null) { Destroyed(obj); } }
private void OnAwaked(ExposeToEditor obj) { if (m_editor.IsPlaying || m_editor.IsPlaymodeStateChanging) { obj.SendMessage("RuntimeAwake", SendMessageOptions.DontRequireReceiver); if (!m_playModeCache.Contains(obj)) { m_playModeCache.Add(obj); } } else { obj.SendMessage("EditorAwake", SendMessageOptions.DontRequireReceiver); if (!m_editModeCache.Contains(obj)) { m_editModeCache.Add(obj); if (m_editor.IsOpened) { TryToAddColliders(obj); } else { TryToDestroyColliders(obj); } } } if (Awaked != null) { Awaked(obj); } }
private void OnStarted(ExposeToEditor obj) { if (m_editor.IsPlaying) { obj.SendMessage("RuntimeStart", SendMessageOptions.DontRequireReceiver); } else { obj.SendMessage("EditorStart", SendMessageOptions.DontRequireReceiver); } if (Started != null) { Started(obj); } }