using System;
using UnityEngine.InputSystem;
using UnityEngine;
#if UNITY_EDITOR
using UnityEngine.InputSystem.Editor;
#endif
using UnityEngine.InputSystem.Utilities;
namespace UnityEngine.InputSystem
{
// ISX-1860 - #ifdef out Domain Reload specific functionality from CoreCLR
#if UNITY_EDITOR
///
/// A hidden, internal object we put in the editor to bundle input system state
/// and help us survive domain reloads.
///
///
/// Player doesn't need this stuff because there's no domain reloads to survive, and
/// also doesn't have domain reloads.
///
internal class InputSystemStateManager : ScriptableObject, ISerializationCallbackReceiver
{
///
/// References the "core" input state that must survive domain reloads.
///
[SerializeField] public InputSystemState systemState;
///
/// Triggers Editor restart when enabling NewInput back-ends.
///
[SerializeField] public bool newInputBackendsCheckedAsEnabled;
///
/// Saves and restores InputSettings across domain reloads
///
///
/// InputSettings are serialized to JSON which this string holds.
///
[SerializeField] public string settings;
///
/// Timestamp retrieved from InputRuntime.currentTime when exiting EditMode.
///
///
/// All input events occurring between exiting EditMode and entering PlayMode are discarded.
///
[SerializeField] public double exitEditModeTime;
///
/// Timestamp retrieved from InputRuntime.currentTime when entering PlayMode.
///
///
/// All input events occurring between exiting EditMode and entering PlayMode are discarded.
///
[SerializeField] public double enterPlayModeTime;
public void OnBeforeSerialize()
{
// Save current system state.
if (InputSystem.s_Manager != null)
{
systemState.manager = InputSystem.s_Manager;
systemState.managerState = InputSystem.s_Manager.SaveState();
}
if (InputSystem.s_Remote != null)
{
systemState.remote = InputSystem.s_Remote;
systemState.remotingState = InputSystem.s_Remote.SaveState();
}
systemState.remoteConnection = InputSystem.remoteConnection;
systemState.userSettings = InputEditorUserSettings.s_Settings;
}
public void OnAfterDeserialize()
{
}
}
#endif // UNITY_EDITOR
}