diff --git a/Assets/Tests/InputSystem.Editor/InputActionReferenceEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionReferenceEditorTests.cs index b8ae447c81..02d2be0f4f 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionReferenceEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionReferenceEditorTests.cs @@ -98,7 +98,7 @@ private void DisableDomainReloads() EditorPrefsTestUtils.DisableDomainReload(); } - private static InputActionBehaviour GetBehaviour() => Object.FindFirstObjectByType(); + private static InputActionBehaviour GetBehaviour() => Object.FindAnyObjectByType(); private static InputActionAsset GetAsset() => AssetDatabase.LoadAssetAtPath(assetPath); // For unclear reason, NUnit fails to assert throwing exceptions after transition into play-mode. diff --git a/Assets/Tests/InputSystem/Plugins/UITests.cs b/Assets/Tests/InputSystem/Plugins/UITests.cs index 15f17299ea..6b246bd5db 100644 --- a/Assets/Tests/InputSystem/Plugins/UITests.cs +++ b/Assets/Tests/InputSystem/Plugins/UITests.cs @@ -4601,6 +4601,7 @@ private class UICallbackReceiver : MonoBehaviour, IPointerClickHandler, IPointer IPointerMoveHandler, IPointerExitHandler, IPointerUpHandler, IMoveHandler, ISelectHandler, IDeselectHandler, IInitializePotentialDragHandler, IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler, ISubmitHandler, ICancelHandler, IScrollHandler { + [Serializable] public struct Event { public EventType type { get; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/AxisControl.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/AxisControl.cs index d69846c5e2..d584108efc 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/AxisControl.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/AxisControl.cs @@ -1,3 +1,4 @@ +using System; using System.Runtime.CompilerServices; using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Processors; @@ -16,6 +17,7 @@ namespace UnityEngine.InputSystem.Controls /// Can optionally be configured to perform normalization. /// Stored as either a float, a short, a byte, or a single bit. /// + [Serializable] public class AxisControl : InputControl { /// diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/ButtonControl.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/ButtonControl.cs index e04f4ebf8a..dee118c96e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/ButtonControl.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/ButtonControl.cs @@ -1,3 +1,4 @@ +using System; using System.Runtime.CompilerServices; using UnityEngine.InputSystem.LowLevel; using UnityEngine.Scripting; @@ -15,6 +16,7 @@ namespace UnityEngine.InputSystem.Controls /// yield full floating-point values and may thus have a range of values. See /// for how button presses on such buttons are handled. /// + [Serializable] public class ButtonControl : AxisControl { private bool m_NeedsToCheckFramePress = false; diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/InputControl.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/InputControl.cs index cca6b2e07c..9cdc7734f8 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/InputControl.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/InputControl.cs @@ -83,6 +83,7 @@ namespace UnityEngine.InputSystem /// /// /// + [Serializable] [DebuggerDisplay("{DebuggerDisplay(),nq}")] public abstract class InputControl { @@ -1283,6 +1284,7 @@ internal virtual IEnumerable GetProcessors() /// Type of value captured by the control. Note that this does not mean /// that the control has to store data in the given value format. A control that captures float /// values, for example, may be stored in state as byte values instead. + [Serializable] public abstract class InputControl : InputControl where TValue : struct { diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputStateWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputStateWindow.cs index 7e4a5fd7a3..7bf32a8fe5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputStateWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputStateWindow.cs @@ -400,7 +400,7 @@ private void DrawHexDump() // against any mutations. // When inspecting controls (as opposed to events), we copy all their various // state buffers and allow switching between them. - [SerializeField] private byte[][] m_StateBuffers; + [NonSerialized] private byte[][] m_StateBuffers; [SerializeField] private int m_SelectedStateBuffer; [SerializeField] private bool m_CompareStateBuffers; [SerializeField] private bool m_ShowDifferentOnly; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs index 01190a3ad4..df34c468a8 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs @@ -59,6 +59,8 @@ private int GetActionMapIndex(InputActionsEditorState state) return cutActionMapIndex ?? -1; } } + + [Serializable] internal struct InputActionsEditorState { public int selectedActionMapIndex { get {return m_selectedActionMapIndex; } } diff --git a/Packages/com.unity.inputsystem/InputSystem/State/InputStateBuffers.cs b/Packages/com.unity.inputsystem/InputSystem/State/InputStateBuffers.cs index 8bcffd38b4..eae5349bbe 100644 --- a/Packages/com.unity.inputsystem/InputSystem/State/InputStateBuffers.cs +++ b/Packages/com.unity.inputsystem/InputSystem/State/InputStateBuffers.cs @@ -13,6 +13,7 @@ namespace UnityEngine.InputSystem.LowLevel // Internally, we perform only a single combined unmanaged allocation for all state // buffers needed by the system. Externally, we expose them as if they are each separate // buffers. + [Serializable] internal unsafe struct InputStateBuffers { // State buffers are set up in a double buffering scheme where the "back buffer" diff --git a/Packages/com.unity.inputsystem/InputSystem/Utilities/FourCC.cs b/Packages/com.unity.inputsystem/InputSystem/Utilities/FourCC.cs index 8a024ec036..4e1c220baf 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Utilities/FourCC.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Utilities/FourCC.cs @@ -11,6 +11,7 @@ namespace UnityEngine.InputSystem.Utilities /// FourCCs are frequently used in the input system to identify the format of data sent to or from /// the native backend representing events, input device state or commands sent to input devices. /// + [Serializable] public struct FourCC : IEquatable { private int m_Code;