UIInputOnGUI.cs 367 B

12345678910111213141516171819202122
  1. using System;
  2. using UnityEngine;
  3. [RequireComponent(typeof(UIInput))]
  4. public class UIInputOnGUI : MonoBehaviour
  5. {
  6. private void Awake()
  7. {
  8. this.mInput = base.GetComponent<UIInput>();
  9. }
  10. private void OnGUI()
  11. {
  12. if (Event.current.rawType == EventType.KeyDown)
  13. {
  14. this.mInput.ProcessEvent(Event.current);
  15. }
  16. }
  17. [NonSerialized]
  18. private UIInput mInput;
  19. }