Guest User

ac input

a guest
Jan 24th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using AC;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5.  
  6.  
  7. public class DetectInputMethod : MonoBehaviour
  8. {
  9.  
  10. private void Update()
  11. {
  12. Event currentEvent = Event.current;
  13. if (currentEvent.isMouse)
  14. {
  15. SetInputMethod(InputMethod.MouseAndKeyboard);
  16. }
  17. else
  18. {
  19. SetInputMethod(InputMethod.KeyboardOrController);
  20. }
  21. }
  22.  
  23.  
  24. private void SetInputMethod(InputMethod inputMethod)
  25. {
  26. if (KickStarter.settingsManager.inputMethod != inputMethod)
  27. {
  28. KickStarter.settingsManager.inputMethod = inputMethod;
  29.  
  30. // Plus anything else you may want/need to do when changing input
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment