public override void OnDestroy() { // Handle the mouse input //m_RewiredPlayer.RemoveInputEventDelegate(OnMouseInput); // When we shut down, let's take care of all this junk. if (m_RewiredPlayer != null && m_InputDelegateCache != null && m_InputDelegateCache.Count > 0) { for (int i = 0; i < m_InputDelegateCache.Count; ++i) { m_RewiredPlayer.RemoveInputEventDelegate(m_InputDelegateCache[i]); } m_InputDelegateCache.Clear(); } else if (m_InputDelegateCache != null && m_InputDelegateCache.Count > 0) { m_InputDelegateCache.Clear(); } ReInput.ControllerConnectedEvent -= OnControllerConnected; ReInput.ControllerDisconnectedEvent -= OnControllerDisconnected; base.OnDestroy(); }