public void OnGUI() { if (Rebinding) { Event e = Event.current; if (e.isKey && e.keyCode != KeyCode.Escape) { KeyCode kc = e.keyCode; KeybindingController.SetControlKeybind(controlToBind, kc); StopRebindProcess(); } else if (e.shift) { if (Input.GetKey(KeyCode.LeftShift)) { KeybindingController.SetControlKeybind(controlToBind, KeyCode.LeftShift); } else { KeybindingController.SetControlKeybind(controlToBind, KeyCode.RightShift); } StopRebindProcess(); } else if (e.isMouse) { switch (e.button) { case 0: KeybindingController.SetControlKeybind(controlToBind, MouseCode.LeftMouseButton); break; case 1: KeybindingController.SetControlKeybind(controlToBind, MouseCode.RightMouseButton); break; case 2: KeybindingController.SetControlKeybind(controlToBind, MouseCode.MiddleMouseButton); break; default: Debug.Log(e.button); break; } StopRebindProcess(); } else if (e.isScrollWheel) { if (e.delta.y < 0) // scroll up { KeybindingController.SetControlKeybind(controlToBind, MouseCode.MouseWheelUp); } else // scroll down { KeybindingController.SetControlKeybind(controlToBind, MouseCode.MouseWheelDown); } StopRebindProcess(); } } }