No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

iOSSupport.cs 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #if UNITY_EDITOR || UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS
  2. using UnityEngine.InputSystem.iOS.LowLevel;
  3. using UnityEngine.InputSystem.Layouts;
  4. using UnityEngine.InputSystem.LowLevel;
  5. namespace UnityEngine.InputSystem.iOS
  6. {
  7. #if UNITY_DISABLE_DEFAULT_INPUT_PLUGIN_INITIALIZATION
  8. public
  9. #else
  10. internal
  11. #endif
  12. static class iOSSupport
  13. {
  14. public static void Initialize()
  15. {
  16. InputSystem.RegisterLayout<iOSGameController>("iOSGameController",
  17. matches: new InputDeviceMatcher()
  18. .WithInterface("iOS")
  19. .WithDeviceClass("iOSGameController"));
  20. InputSystem.RegisterLayout<XboxOneGampadiOS>("XboxOneGampadiOS",
  21. matches: new InputDeviceMatcher()
  22. .WithInterface("iOS")
  23. .WithDeviceClass("iOSGameController")
  24. .WithProduct("Xbox Wireless Controller"));
  25. InputSystem.RegisterLayout<DualShock4GampadiOS>("DualShock4GampadiOS",
  26. matches: new InputDeviceMatcher()
  27. .WithInterface("iOS")
  28. .WithDeviceClass("iOSGameController")
  29. .WithProduct("DUALSHOCK 4 Wireless Controller"));
  30. InputSystem.RegisterLayout<DualSenseGampadiOS>("DualSenseGampadiOS",
  31. matches: new InputDeviceMatcher()
  32. .WithInterface("iOS")
  33. .WithDeviceClass("iOSGameController")
  34. .WithProduct("DualSense Wireless Controller"));
  35. InputSystem.RegisterLayoutMatcher("GravitySensor",
  36. new InputDeviceMatcher()
  37. .WithInterface("iOS")
  38. .WithDeviceClass("Gravity"));
  39. InputSystem.RegisterLayoutMatcher("AttitudeSensor",
  40. new InputDeviceMatcher()
  41. .WithInterface("iOS")
  42. .WithDeviceClass("Attitude"));
  43. InputSystem.RegisterLayoutMatcher("LinearAccelerationSensor",
  44. new InputDeviceMatcher()
  45. .WithInterface("iOS")
  46. .WithDeviceClass("LinearAcceleration"));
  47. #if UNITY_EDITOR || UNITY_IOS
  48. InputSystem.RegisterLayout<iOSStepCounter>();
  49. // Don't add devices for InputTestRuntime
  50. // TODO: Maybe there should be a better place for adding device from C#
  51. if (InputSystem.s_Manager.m_Runtime is NativeInputRuntime)
  52. {
  53. if (iOSStepCounter.IsAvailable())
  54. InputSystem.AddDevice<iOSStepCounter>();
  55. }
  56. #endif
  57. }
  58. }
  59. }
  60. #endif // UNITY_EDITOR || UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS