InputSystemObject.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #if UNITY_EDITOR
  2. using UnityEngine.InputSystem.Editor;
  3. namespace UnityEngine.InputSystem
  4. {
  5. /// <summary>
  6. /// A hidden, internal object we put in the editor to bundle input system state
  7. /// and help us survive domain reloads.
  8. /// </summary>
  9. /// <remarks>
  10. /// Player doesn't need this stuff because there's no domain reloads to survive.
  11. /// </remarks>
  12. internal class InputSystemObject : ScriptableObject, ISerializationCallbackReceiver
  13. {
  14. [SerializeField] public InputSystem.State systemState;
  15. [SerializeField] public bool newInputBackendsCheckedAsEnabled;
  16. [SerializeField] public string settings;
  17. [SerializeField] public double exitEditModeTime;
  18. [SerializeField] public double enterPlayModeTime;
  19. public void OnBeforeSerialize()
  20. {
  21. // Save current system state.
  22. systemState.manager = InputSystem.s_Manager;
  23. systemState.remote = InputSystem.s_Remote;
  24. systemState.remoteConnection = InputSystem.s_RemoteConnection;
  25. systemState.managerState = InputSystem.s_Manager.SaveState();
  26. systemState.remotingState = InputSystem.s_Remote.SaveState();
  27. systemState.userSettings = InputEditorUserSettings.s_Settings;
  28. }
  29. public void OnAfterDeserialize()
  30. {
  31. }
  32. }
  33. }
  34. #endif // UNITY_EDITOR