/// <summary> /// Shuts down the manager. /// </summary> public void Shutdown() { if (!m_Initialized) { return; } m_MessageQueue.Clear(); foreach (MessengerImpl impl in m_MessengerRegistry.Values) { impl.Destroy(false); } m_MessengerRegistry.Clear(); if (Host != null) { Host.Shutdown(); GameObject.Destroy(Host.gameObject); Host = null; } Log("Shutdown()"); m_Initialized = false; s_Instance = null; }
public void Initialize() { if (m_Initialized) { return; } #if DEVELOPMENT DebugMode = true; #else DebugMode = UnityEngine.Debug.isDebugBuild; #endif GameObject hostGO = new GameObject("Messenger::Manager"); Host = hostGO.AddComponent <MessengerUnityHost>(); Host.Initialize(this); //hostGO.hideFlags = HideFlags.HideAndDontSave; GameObject.DontDestroyOnLoad(hostGO); Log("Initialize()"); m_Initialized = true; }