/// <summary> /// Shut down the Academy. /// </summary> public void Dispose() { DisableAutomaticStepping(); // Signal to listeners that the academy is being destroyed now DestroyAction?.Invoke(); Communicator?.Dispose(); Communicator = null; if (m_ModelRunners != null) { foreach (var mr in m_ModelRunners) { mr.Dispose(); } m_ModelRunners = null; } // Clear out the actions so we're not keeping references to any old objects ResetActions(); // TODO - Pass worker ID or some other identifier, // so that multiple envs won't overwrite each others stats. TimerStack.Instance.SaveJsonTimers(); FloatProperties = null; m_Initialized = false; // Reset the Lazy instance s_Lazy = new Lazy <Academy>(() => new Academy()); }
/// <summary> /// Deinitialized this SceneObject and all its hierarchical decendants. /// </summary> public void Destroy() { if (IsUpdateable) { SceneManager.RemoveUpdateReceiver(Update, Render, Root); } DestroyAction?.Invoke(); var children = new List <Transform>(Transform.Children); foreach (var t in children) { t.Owner.Destroy(); } var components = new List <UIComponent>(Components); components.ForEach(x => x.Destroy()); if (Parent != null) { Parent.Transform.Children.Remove(Transform); } }
/// <summary> /// Removes this UIComponent from its parent and unregisters it as UpdateReceiver. Invokes function OnDestroy. /// </summary> public void Destroy() { Owner.Components.Remove(this); if (IsUpdateable) { SceneManager.RemoveUpdateReceiver(Update, Render, Root); } DestroyAction?.Invoke(); }
/// <summary> /// Cleanup function /// </summary> protected void OnDestroy() { // Signal to listeners that the academy is being destroyed now DestroyAction?.Invoke(); foreach (var mr in m_ModelRunners) { mr.Dispose(); } // TODO - Pass worker ID or some other identifier, // so that multiple envs won't overwrite each others stats. TimerStack.Instance.SaveJsonTimers(); }
/// <summary> /// Cleanup function /// </summary> protected virtual void OnDestroy() { Physics.gravity = m_OriginalGravity; Time.fixedDeltaTime = m_OriginalFixedDeltaTime; Time.maximumDeltaTime = m_OriginalMaximumDeltaTime; // Signal to listeners that the academy is being destroyed now DestroyAction?.Invoke(); foreach (var mr in m_ModelRunners) { mr.Dispose(); } // TODO - Pass worker ID or some other identifier, // so that multiple envs won't overwrite each others stats. TimerStack.Instance.SaveJsonTimers(); }