From 3efea32e5098062975855ab0a9085bb14d72c050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Wed, 4 Dec 2024 16:44:06 +0200 Subject: [PATCH 1/6] Improve UIInputModule documentation and examples Only the examples that are reused across the class are in a "external" file so that they can be reference in multiple examples. I'd like to be consistent about this and have all examples in files. but this is a much bigger effort at the moment. --- ...SystemUIInputModuleAssignActionsExample.cs | 41 +++ ...mUIInputModuleAssignActionsExample.cs.meta | 3 + .../Plugins/UI/InputSystemUIInputModule.cs | 278 ++++++++++++++---- 3 files changed, 260 insertions(+), 62 deletions(-) create mode 100644 Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs create mode 100644 Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs.meta diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs new file mode 100644 index 0000000000..0c7893163b --- /dev/null +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using UnityEngine.InputSystem.UI; +using UnityEngine.Serialization; + +namespace DocCodeSamples.Tests +{ + internal class InputSystemUIInputModuleAssignActionsExample : MonoBehaviour + { + // Reference to the InputSystemUIInputModule component, needs to be provided in the Inspector + [FormerlySerializedAs("inputModule")] + public InputSystemUIInputModule uiModule; + + void Start() + { + // Assign default actions + AssignActions(); + } + + void AssignActions() + { + if (uiModule != null) + uiModule.AssignDefaultActions(); + else + Debug.LogError("InputSystemUIInputModule not found."); + } + + void UnassignActions() + { + if (uiModule != null) + uiModule.UnassignActions(); + else + Debug.LogError("InputSystemUIInputModule not found."); + } + + void OnDestroy() + { + // Unassign actions when the object is destroyed + UnassignActions(); + } + } +} diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs.meta b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs.meta new file mode 100644 index 0000000000..0dfa4a76f7 --- /dev/null +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 026e1117180341c1bf7847a2cc61f75b +timeCreated: 1733488542 \ No newline at end of file diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs index c72e043c71..db6c7dd596 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs @@ -39,22 +39,83 @@ namespace UnityEngine.InputSystem.UI /// Input module that takes its input from input actions. /// /// + /// + /// This module processes all UI input based on the Input System. It is the "glue" between UI systems (UGUI, UITK) + /// and the Input System. + /// + /// + /// When adding this component from code (such as through GameObject.AddComponent), the + /// resulting module will automatically have assigned to it. + /// If you want to use your own actions, you should create an with the necessary + /// UI actions. You can copy the default actions and edit them as you need. To have editable Input Actions + /// out-of-the box you can use the project-wide actions through InputSystem.actions. More information about this + /// can be read in the manual documentation. + /// + /// + /// This module can be configured in the Editor > Inspector when added as a component to a GameObject. + /// + /// /// This UI input module has the advantage over other such modules that it doesn't have to know /// what devices and types of devices input is coming from. Instead, the actions hide the actual /// sources of input from the module. - /// - /// When adding this component from code (such as through GameObject.AddComponent), the - /// resulting module will automatically have a set of default input actions assigned to it - /// (see ). + /// /// + /// + /// + /// + /// + /// + /// + /// + /// using UnityEngine; + /// using UnityEngine.InputSystem; + /// using UnityEngine.InputSystem.UI; + /// using UnityEngine.EventSystems; + /// + /// class InputSystemUIInputModuleExample : MonoBehaviour + /// { + /// private InputSystemUIInputModule uiModule; + /// + /// // Configure the InputSystemUIInputModule component programmatically on Start() + /// // But a lot of this could be done at runtime as well. + /// void Start() + /// { + /// // Find the EventSystem in the scene + /// var eventSystem = EventSystem.current; + /// + /// // Get the InputSystemUIInputModule component + /// uiModule = eventSystem.GetComponent(); + /// + /// // Using the default input actions just as an example. Another InputActionAsset can be used. + /// DefaultInputActions defaultInputActions = new DefaultInputActions(); + /// // Example on how to assign individual actions programmatically + /// uiModule.actionsAsset = defaultInputActions.asset; + /// uiModule.leftClick = InputActionReference.Create(defaultInputActions.UI.Click); + /// uiModule.scrollWheel = InputActionReference.Create(defaultInputActions.UI.ScrollWheel); + /// + /// // Set other fields programmatically + /// uiModule.deselectOnBackgroundClick = true; + /// uiModule.pointerBehavior = UIPointerBehavior.SingleMouseOrPenButMultiTouchAndTrack; + /// uiModule.cursorLockBehavior = InputSystemUIInputModule.CursorLockBehavior.ScreenCenter; + /// } + /// + /// // Example on how programmatically set the move repeat delay based on the move repeat rate + /// void SetMoveRepeat(float value) + /// { + /// uiModule.moveRepeatRate = value; + /// uiModule.moveRepeatDelay = value * (1.2f); + /// } + /// } + /// + /// [HelpURL(InputSystem.kDocUrl + "/manual/UISupport.html#setting-up-ui-input")] public class InputSystemUIInputModule : BaseInputModule { /// /// Whether to clear the current selection when a click happens that does not hit any GameObject. /// - /// If true (default), clicking outside of any GameObject will reset the current selection. /// + /// If true (default), clicking outside of any GameObject will reset the current selection /// By toggling this behavior off, background clicks will keep the current selection. I.e. /// EventSystem.currentSelectedGameObject will not be changed. /// @@ -137,6 +198,35 @@ public float scrollDeltaPerTick /// /// Called by EventSystem when the input module is made current. /// + /// + /// There's no need to call this method directly unless for specific reasons. + /// It is called by EventSystem when the input module is made current. + /// It sets to + /// if nothing is selected. + /// + /// + /// + /// using UnityEngine; + /// using UnityEngine.EventSystems; + /// using UnityEngine.InputSystem.UI; + /// + /// public class ActivateModuleExample : MonoBehaviour + /// { + /// private InputSystemUIInputModule uiModule; + /// void Start() + /// { + /// // Find the EventSystem in the scene + /// var eventSystem = EventSystem.current; + /// + /// // Get the InputSystemUIInputModule component + /// uiModule = eventSystem.GetComponent<InputSystemUIInputModule>(); + /// + /// // Manually activate the module + /// uiModule.ActivateModule(); + /// } + /// } + /// + /// public override void ActivateModule() { base.ActivateModule(); @@ -177,7 +267,7 @@ public override void ActivateModule() /// Calling this method from within an callback (such as ) /// will result in a warning. See the "UI vs Game Input" sample shipped with the Input System package for /// how to deal with this fact. - /// + /// /// /// /// // In general, the pointer ID corresponds to the device ID: @@ -197,7 +287,6 @@ public override void ActivateModule() /// EventSystem.current.IsPointerOverGameObject(); // Equivalent. /// /// - /// /// /// public override bool IsPointerOverGameObject(int pointerOrTouchId) @@ -252,6 +341,44 @@ public override bool IsPointerOverGameObject(int pointerOrTouchId) /// /// /// + /// + /// + /// using UnityEngine; + /// using UnityEngine.EventSystems; + /// using UnityEngine.InputSystem; + /// using UnityEngine.InputSystem.UI; + /// + /// public class GetLastRaycastResultExample : MonoBehaviour + /// { + /// public InputSystemUIInputModule uiModule; + /// + /// void PrintLastRaycastResult(int pointerId) + /// { + /// if (uiModule) + /// { + /// // Retrieve the last raycast result for the given pointer ID + /// RaycastResult raycastResult = uiModule.GetLastRaycastResult(pointerId); + /// + /// // Check if the raycast result is valid + /// if (raycastResult.isValid) + /// { + /// // Print details about the raycast result + /// Debug.Log($"Pointer ID: {pointerId}"); + /// Debug.Log($"Hit GameObject: {raycastResult.gameObject.name}"); + /// Debug.Log($"Distance: {raycastResult.distance}"); + /// Debug.Log($"World Position: {raycastResult.worldPosition}"); + /// } + /// } + /// + /// } + /// + /// void Update() + /// { + /// PrintLastRaycastResult(Mouse.current.deviceId); + /// } + /// } + /// + /// public RaycastResult GetLastRaycastResult(int pointerOrTouchId) { var stateIndex = GetPointerStateIndexFor(pointerOrTouchId); @@ -850,7 +977,6 @@ private bool IsMoveAllowed(AxisEventData eventData) /// /// /// - /// public float moveRepeatDelay { get => m_MoveRepeatDelay; @@ -867,9 +993,6 @@ public float moveRepeatDelay /// Note that a maximum of one will be sent per frame. This means that even if multiple time /// increments of the repeat delay have passed since the last update, only one move repeat event will be generated. /// - /// - /// - /// public float moveRepeatRate { get => m_MoveRepeatRate; @@ -887,6 +1010,9 @@ private bool shouldIgnoreFocus get => explictlyIgnoreFocus || InputRuntime.s_Instance.runInBackground; } + /// + /// (Obsolete) + /// [Obsolete("'repeatRate' has been obsoleted; use 'moveRepeatRate' instead. (UnityUpgradable) -> moveRepeatRate", false)] public float repeatRate { @@ -894,6 +1020,9 @@ public float repeatRate set => moveRepeatRate = value; } + /// + /// (Obsolete) + /// [Obsolete("'repeatDelay' has been obsoleted; use 'moveRepeatDelay' instead. (UnityUpgradable) -> moveRepeatDelay", false)] public float repeatDelay { @@ -903,10 +1032,14 @@ public float repeatDelay /// /// A representing the real world origin for tracking devices. - /// This is used to convert real world positions and rotations for pointers into Unity's global space. - /// When using the XR Interaction Toolkit, this should be pointing to the XR Rig's Transform. /// - /// This will transform all tracked pointers. If unset, or set to null, the Unity world origin will be used as the basis for all tracked positions and rotations. + /// + /// This is used to convert real world positions and rotations for all + /// pointers into Unity's global space. + /// When using the XR Interaction Toolkit, this should be pointing to the XR Rig's Transform. + /// If unset, or set to null, the Unity world origin will be used as the basis for all tracked positions and + /// rotations. + /// public Transform xrTrackingOrigin { get => m_XRTrackingOrigin; @@ -999,10 +1132,6 @@ private bool IsNavigationAction(InputActionReference reference) /// /// /// - /// - /// - /// - /// public InputActionReference point { get => m_PointAction; @@ -1044,10 +1173,6 @@ public InputActionReference point /// /// /// - /// - /// - /// - /// public InputActionReference scrollWheel { get => m_ScrollWheelAction; @@ -1090,10 +1215,6 @@ public InputActionReference scrollWheel /// /// /// - /// - /// - /// - /// public InputActionReference leftClick { get => m_LeftClickAction; @@ -1141,10 +1262,6 @@ public InputActionReference leftClick /// /// /// - /// - /// - /// - /// public InputActionReference middleClick { get => m_MiddleClickAction; @@ -1192,10 +1309,6 @@ public InputActionReference middleClick /// /// /// - /// - /// - /// - /// public InputActionReference rightClick { get => m_RightClickAction; @@ -1237,8 +1350,6 @@ public InputActionReference rightClick /// /// /// - /// - /// public InputActionReference move { get => m_MoveAction; @@ -1279,8 +1390,6 @@ public InputActionReference move /// /// /// - /// - /// public InputActionReference submit { get => m_SubmitAction; @@ -1321,8 +1430,6 @@ public InputActionReference submit /// /// /// - /// - /// public InputActionReference cancel { get => m_CancelAction; @@ -1364,7 +1471,6 @@ public InputActionReference cancel /// /// /// - /// public InputActionReference trackedDeviceOrientation { get => m_TrackedDeviceOrientationAction; @@ -1406,7 +1512,6 @@ public InputActionReference trackedDeviceOrientation /// /// /// - /// public InputActionReference trackedDevicePosition { get => m_TrackedDevicePositionAction; @@ -1424,26 +1529,10 @@ public InputActionReference trackedDevicePosition /// Note that if an InputSystemUIInputModule component is programmatically added to a GameObject, /// it will automatically receive the default actions as part of its OnEnable method. Use /// to remove these assignments. - /// + /// /// - /// - /// var go = new GameObject(); - /// go.AddComponent<EventSystem>(); - /// - /// // Adding the UI module like this will implicitly enable it and thus lead to - /// // automatic assignment of the default input actions. - /// var uiModule = go.AddComponent<InputSystemUIInputModule>(); - /// - /// // Manually remove the default input actions. - /// uiModule.UnassignActions(); - /// + /// /// - /// - /// - /// - - private static DefaultInputActions defaultActions; - public void AssignDefaultActions() { if (defaultActions == null) @@ -1463,14 +1552,24 @@ public void AssignDefaultActions() trackedDevicePosition = InputActionReference.Create(defaultActions.UI.TrackedDevicePosition); } + private static DefaultInputActions defaultActions; + /// - /// Remove all action assignments, that is as well as all individual - /// actions such as . + /// Remove all action assignments. /// /// + /// Resets reference as well as all individual + /// actions references, such as , and removes the correspondent callbacks hooked for + /// and + /// + /// It also disposes . + /// /// If the current actions were enabled by the UI input module, they will be disabled in the process. /// /// + /// + /// + /// public void UnassignActions() { defaultActions?.Dispose(); @@ -1488,6 +1587,10 @@ public void UnassignActions() trackedDevicePosition = default; } + /// + /// (Obsolete) This API has been obsoleted; use instead. + /// + /// [Obsolete("'trackedDeviceSelect' has been obsoleted; use 'leftClick' instead.", true)] public InputActionReference trackedDeviceSelect { @@ -1496,6 +1599,7 @@ public InputActionReference trackedDeviceSelect } #if UNITY_EDITOR + /// protected override void Reset() { base.Reset(); @@ -1509,6 +1613,7 @@ protected override void Reset() #endif + /// protected override void Awake() { base.Awake(); @@ -1516,6 +1621,7 @@ protected override void Awake() m_NavigationState.Reset(); } + /// protected override void OnDestroy() { base.OnDestroy(); @@ -1523,6 +1629,7 @@ protected override void OnDestroy() UnhookActions(); } + /// protected override void OnEnable() { base.OnEnable(); @@ -1540,6 +1647,7 @@ protected override void OnEnable() EnableAllActions(); } + /// protected override void OnDisable() { ResetPointers(); @@ -2222,6 +2330,49 @@ private void FilterPointerStatesByType() } } + /// + /// + /// This method is automatically called by once per frame. + /// There is no need to call it manually. Unless for specific use cases. + /// + /// It processes all and pointer types, + /// as well as navigation input state from and . + /// These fields hold state based on the actions set up for the UI action map of . + /// The InputAction callbacks are responsible for updating their state, which means state can change multiple + /// times during a frame, even though it will only be processed once per frame. For example, in case there are + /// multiple clicks or touches in a single frame, they can allocate multiple pointers in the same frame, which + /// will all then be processed by frame when calls this method. + /// + /// Also, this method is responsible for purging stale pointers when a device is removed, and for filtering + /// pointer states + /// + /// + /// + /// + /// using UnityEngine; + /// using UnityEngine.InputSystem.UI; + /// + /// public class CustomInputModuleProcessor : MonoBehaviour + /// { + /// // Reference to the InputSystemUIInputModule, set in the Inspector + /// public InputSystemUIInputModule uiModule; + /// + /// void Update() + /// { + /// // Process the input module in the Update loop for a specific case + /// // if this needs to be called outside the EventSystem.Update() event + /// if (uiModule != null) + /// { + /// uiModule.Process(); + /// } + /// } + /// } + /// + /// + /// + /// + /// + /// public override void Process() { if (m_NeedToPurgeStalePointers) @@ -2380,6 +2531,9 @@ private InputActionReference UpdateReferenceForNewAsset(InputActionReference act return InputActionReference.Create(newAction); } + /// + /// The that contains the necessary UI actions used by the UI module. + /// public InputActionAsset actionsAsset { get => m_ActionsAsset; From 866bd2d2ca99b2afccfa7934de625bc50cc621c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Mon, 9 Dec 2024 14:17:21 +0200 Subject: [PATCH 2/6] Fix code example escaped chars --- .../InputSystem/Plugins/UI/InputSystemUIInputModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs index db6c7dd596..4d80420a8f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs @@ -84,7 +84,7 @@ namespace UnityEngine.InputSystem.UI /// var eventSystem = EventSystem.current; /// /// // Get the InputSystemUIInputModule component - /// uiModule = eventSystem.GetComponent(); + /// uiModule = eventSystem.GetComponent<InputSystemUIInputModule>(); /// /// // Using the default input actions just as an example. Another InputActionAsset can be used. /// DefaultInputActions defaultInputActions = new DefaultInputActions(); From da0675a2d30b8bd0920e4f44bc11d672ae5543e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Mon, 9 Dec 2024 14:44:14 +0200 Subject: [PATCH 3/6] Fix asmdef --- .../DocCodeSamples.Tests/DocCodeSamples.asmdef | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef index 180bbcadf0..6e8b6248e1 100644 --- a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef @@ -4,7 +4,9 @@ "references": [ "GUID:75469ad4d38634e559750d17036d5f7c" ], - "includePlatforms": [], + "includePlatforms": [ + "Editor" + ], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": true, From be40abca4dd0241923724ef63c9fd6e7ccb54c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Mon, 9 Dec 2024 14:56:45 +0200 Subject: [PATCH 4/6] Fix another example code issue --- .../InputSystemUIInputModuleAssignActionsExample.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs index 0c7893163b..d8dd36b31e 100644 --- a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs @@ -1,13 +1,11 @@ using UnityEngine; using UnityEngine.InputSystem.UI; -using UnityEngine.Serialization; namespace DocCodeSamples.Tests { internal class InputSystemUIInputModuleAssignActionsExample : MonoBehaviour { // Reference to the InputSystemUIInputModule component, needs to be provided in the Inspector - [FormerlySerializedAs("inputModule")] public InputSystemUIInputModule uiModule; void Start() From 1098bb15b5805d11e28c9e01ae563d35ae2dc95d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Mon, 9 Dec 2024 15:45:27 +0200 Subject: [PATCH 5/6] Fix package validation errors --- .../DocCodeSamples.asmdef | 93 ++++++++++++++++++- ...SystemUIInputModuleAssignActionsExample.cs | 3 + 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef index 6e8b6248e1..a98a2b2ca6 100644 --- a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef @@ -13,6 +13,97 @@ "precompiledReferences": [], "autoReferenced": false, "defineConstraints": [], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.unity.xr.oculus", + "expression": "1.0.3", + "define": "DISABLE_BUILTIN_INPUT_SYSTEM_OCULUS" + }, + { + "name": "com.unity.xr.googlevr", + "expression": "1.0.0", + "define": "DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR" + }, + { + "name": "com.unity.xr.openvr", + "expression": "1.0.0", + "define": "DISABLE_BUILTIN_INPUT_SYSTEM_OPENVR" + }, + { + "name": "com.unity.xr.windowsmr", + "expression": "2.0.3", + "define": "DISABLE_BUILTIN_INPUT_SYSTEM_WINDOWSMR" + }, + { + "name": "com.unity.modules.vr", + "expression": "1.0.0", + "define": "UNITY_INPUT_SYSTEM_ENABLE_VR" + }, + { + "name": "com.unity.modules.xr", + "expression": "1.0.0", + "define": "UNITY_INPUT_SYSTEM_ENABLE_XR" + }, + { + "name": "com.unity.modules.physics", + "expression": "1.0.0", + "define": "UNITY_INPUT_SYSTEM_ENABLE_PHYSICS" + }, + { + "name": "com.unity.modules.physics2d", + "expression": "1.0.0", + "define": "UNITY_INPUT_SYSTEM_ENABLE_PHYSICS2D" + }, + { + "name": "com.unity.ugui", + "expression": "1.0.0", + "define": "UNITY_INPUT_SYSTEM_ENABLE_UI" + }, + { + "name": "Unity", + "expression": "[2021.3.11,2022.1)", + "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" + }, + { + "name": "Unity", + "expression": "[2022.1.19,2022.2)", + "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" + }, + { + "name": "Unity", + "expression": "2022.2", + "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" + }, + { + "name": "Unity", + "expression": "2022.3", + "define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS" + }, + { + "name": "Unity", + "expression": "1", + "define": "UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST" + }, + { + "name": "Unity", + "expression": "6000.0.9", + "define": "UNITY_INPUT_SYSTEM_PLATFORM_SCROLL_DELTA" + }, + { + "name": "Unity", + "expression": "6000.0.11", + "define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA" + }, + { + "name": "Unity", + "expression": "6000.0.15", + "define": "UNITY_INPUT_SYSTEM_SENDPOINTERHOVERTOPARENT" + }, + { + "name": "com.unity.modules.unityanalytics", + "expression": "1", + "define": "UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs index d8dd36b31e..886f1d61e8 100644 --- a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs @@ -1,3 +1,5 @@ +#if UNITY_INPUT_SYSTEM_ENABLE_UI + using UnityEngine; using UnityEngine.InputSystem.UI; @@ -37,3 +39,4 @@ void OnDestroy() } } } +#endif From 9410bb6aed172715f919ad25d0b384fefa067a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Tue, 10 Dec 2024 10:42:16 +0200 Subject: [PATCH 6/6] Remove unnecessary defines --- .../DocCodeSamples.asmdef | 93 +------------------ 1 file changed, 1 insertion(+), 92 deletions(-) diff --git a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef index a98a2b2ca6..6e8b6248e1 100644 --- a/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef +++ b/Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef @@ -13,97 +13,6 @@ "precompiledReferences": [], "autoReferenced": false, "defineConstraints": [], - "versionDefines": [ - { - "name": "com.unity.xr.oculus", - "expression": "1.0.3", - "define": "DISABLE_BUILTIN_INPUT_SYSTEM_OCULUS" - }, - { - "name": "com.unity.xr.googlevr", - "expression": "1.0.0", - "define": "DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR" - }, - { - "name": "com.unity.xr.openvr", - "expression": "1.0.0", - "define": "DISABLE_BUILTIN_INPUT_SYSTEM_OPENVR" - }, - { - "name": "com.unity.xr.windowsmr", - "expression": "2.0.3", - "define": "DISABLE_BUILTIN_INPUT_SYSTEM_WINDOWSMR" - }, - { - "name": "com.unity.modules.vr", - "expression": "1.0.0", - "define": "UNITY_INPUT_SYSTEM_ENABLE_VR" - }, - { - "name": "com.unity.modules.xr", - "expression": "1.0.0", - "define": "UNITY_INPUT_SYSTEM_ENABLE_XR" - }, - { - "name": "com.unity.modules.physics", - "expression": "1.0.0", - "define": "UNITY_INPUT_SYSTEM_ENABLE_PHYSICS" - }, - { - "name": "com.unity.modules.physics2d", - "expression": "1.0.0", - "define": "UNITY_INPUT_SYSTEM_ENABLE_PHYSICS2D" - }, - { - "name": "com.unity.ugui", - "expression": "1.0.0", - "define": "UNITY_INPUT_SYSTEM_ENABLE_UI" - }, - { - "name": "Unity", - "expression": "[2021.3.11,2022.1)", - "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" - }, - { - "name": "Unity", - "expression": "[2022.1.19,2022.2)", - "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" - }, - { - "name": "Unity", - "expression": "2022.2", - "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" - }, - { - "name": "Unity", - "expression": "2022.3", - "define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS" - }, - { - "name": "Unity", - "expression": "1", - "define": "UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST" - }, - { - "name": "Unity", - "expression": "6000.0.9", - "define": "UNITY_INPUT_SYSTEM_PLATFORM_SCROLL_DELTA" - }, - { - "name": "Unity", - "expression": "6000.0.11", - "define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA" - }, - { - "name": "Unity", - "expression": "6000.0.15", - "define": "UNITY_INPUT_SYSTEM_SENDPOINTERHOVERTOPARENT" - }, - { - "name": "com.unity.modules.unityanalytics", - "expression": "1", - "define": "UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS" - } - ], + "versionDefines": [], "noEngineReferences": false } \ No newline at end of file