static void OnScriptInstanceDestroyed(CryScriptInstance instance) { foreach (KeyEventDelegate d in KeyEvents.GetInvocationList()) { if (d.Target == instance) { KeyEvents -= d; } } foreach (MouseEventDelegate d in MouseEvents.GetInvocationList()) { if (d.Target == instance) { MouseEvents -= d; } } ActionmapEvents.RemoveAll(instance); }