diff --git a/Assets/Samples/OnScreenControls/OnScreenControlsSample.cs b/Assets/Samples/OnScreenControls/OnScreenControlsSample.cs new file mode 100644 index 0000000000..65930d635c --- /dev/null +++ b/Assets/Samples/OnScreenControls/OnScreenControlsSample.cs @@ -0,0 +1,66 @@ +// This example showcases how to use on-screen controls and showcases how to use +// OnScreenStick and OnScreenButton which are two types of on-screen controls included with the Input System. +// In this example, multiple OnScreenButton component instances and OnScreenStick component instances are +// attached to a Canvas to build an on-screen gamepad. +// +// The OnScreenControl game objects LeftStick, RightStick, A, B, X, Y have all been configured to associated +// with a gamepad layout. This implies that they generate input similar to a real hardware gamepad. +// Due to this, InputActions bound to gamepad controls such as the controls mentioned above will hence be +// triggered when the user interacts with the on-screen controls. +// This example uses actions defined in OnScreenControlsSampleActions.inputactions which are preconfigured to +// bind to gamepad controls. Hence this example will work the same way when using either the on-screen controls +// or a physical gamepad. +// +// Note that on-screen controls 1 and 2 on the other hand are bound to a keyboard control layout and therefore +// generates input events similar to a physical hardware keyboard. +// +// When actions defined for this sample are triggered, a log message is generated to show when the actions +// are performed. +// +// Note that actions for this example have been setup to allow either on-screen controls or physical gamepad/keyboard +// controls to be used interchangeably. + +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.OnScreen; + +public sealed class OnScreenControlsSample : MonoBehaviour +{ + public InputActionReference mode1, mode2, leftStick, rightStick, x, y, a, b; + public OnScreenControlUpdateMode updateMode; + + void UpdateCurrentMode(OnScreenControlUpdateMode mode) + { + Debug.Log($"Switched to OnScreenControl Update Mode: {mode.ToString()}"); + foreach (var onScreenControl in GetComponentsInChildren()) + onScreenControl.updateMode = mode; + } + + void EnableAndLogPerformed(InputActionReference reference) + { + reference.action.Enable(); + reference.action.performed += Performed; + } + + void Start() + { + UpdateCurrentMode(updateMode); + EnableAndLogPerformed(mode1); + mode1.action.performed += (_) => UpdateCurrentMode(OnScreenControlUpdateMode.QueueEvents); + EnableAndLogPerformed(mode2); + mode2.action.performed += (_) => UpdateCurrentMode(OnScreenControlUpdateMode.ChangeState); + + EnableAndLogPerformed(x); + EnableAndLogPerformed(y); + EnableAndLogPerformed(a); + EnableAndLogPerformed(b); + + EnableAndLogPerformed(leftStick); + EnableAndLogPerformed(rightStick); + } + + void Performed(InputAction.CallbackContext context) + { + Debug.Log($"Performed action={context.action.name}, Time.frameCount={Time.frameCount}, context.time={context.time}, Time.time={Time.time}"); + } +} diff --git a/Assets/Samples/OnScreenControls/OnScreenControlsSample.cs.meta b/Assets/Samples/OnScreenControls/OnScreenControlsSample.cs.meta new file mode 100644 index 0000000000..654acf1871 --- /dev/null +++ b/Assets/Samples/OnScreenControls/OnScreenControlsSample.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08d714a194a0b45898f07b750bc13dd3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Samples/OnScreenControls/OnScreenControlsSample.unity b/Assets/Samples/OnScreenControls/OnScreenControlsSample.unity index 0a9dde73d7..2bbe791fb5 100644 --- a/Assets/Samples/OnScreenControls/OnScreenControlsSample.unity +++ b/Assets/Samples/OnScreenControls/OnScreenControlsSample.unity @@ -104,7 +104,7 @@ NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: - serializedVersion: 2 + serializedVersion: 3 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 @@ -117,7 +117,7 @@ NavMeshSettings: cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 - accuratePlacement: 0 + buildHeightMesh: 0 maxJobWorkers: 0 preserveTilesOutsideBounds: 0 debug: @@ -128,13 +128,17 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 2 + serializedVersion: 3 m_TransformParent: {fileID: 1993296955} m_Modifications: - target: {fileID: 1613174875475300, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} propertyPath: m_Name value: LeftStick objectReference: {fileID: 0} + - target: {fileID: 1613174875475300, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 114480945186419424, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} propertyPath: m_Behaviour @@ -236,19 +240,25 @@ PrefabInstance: value: -129 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} --- !u!1001 &213445084 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 2 + serializedVersion: 3 m_TransformParent: {fileID: 1993296955} m_Modifications: - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} propertyPath: m_Name - value: Button A + value: Button Y + objectReference: {fileID: 0} + - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} + propertyPath: m_IsActive + value: 1 objectReference: {fileID: 0} - target: {fileID: 114344768413473294, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} @@ -351,7 +361,9 @@ PrefabInstance: value: 172 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} --- !u!224 &223523015 stripped RectTransform: @@ -364,12 +376,16 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 2 + serializedVersion: 3 m_TransformParent: {fileID: 1993296955} m_Modifications: - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} propertyPath: m_Name - value: Button D + value: Button A + objectReference: {fileID: 0} + - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} + propertyPath: m_IsActive + value: 1 objectReference: {fileID: 0} - target: {fileID: 114344768413473294, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} @@ -472,7 +488,9 @@ PrefabInstance: value: 27 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} --- !u!224 &334844326 stripped RectTransform: @@ -520,9 +538,17 @@ Camera: m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 @@ -556,13 +582,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!224 &703313166 stripped RectTransform: @@ -575,18 +601,27 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 2 + serializedVersion: 3 m_TransformParent: {fileID: 1993296955} m_Modifications: - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} propertyPath: m_Name - value: Button B + value: Button X + objectReference: {fileID: 0} + - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} + propertyPath: m_IsActive + value: 1 objectReference: {fileID: 0} - target: {fileID: 114344768413473294, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} propertyPath: m_ControlPath value: //X objectReference: {fileID: 0} + - target: {fileID: 114344768413473294, guid: 05f32eddd3e41fd4597ada617b785928, + type: 3} + propertyPath: m_UseInputChangeState + value: 1 + objectReference: {fileID: 0} - target: {fileID: 114547973042304788, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} propertyPath: m_Text @@ -693,7 +728,9 @@ PrefabInstance: value: 102 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} --- !u!224 &827737258 stripped RectTransform: @@ -706,12 +743,16 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 2 + serializedVersion: 3 m_TransformParent: {fileID: 1993296955} m_Modifications: - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} propertyPath: m_Name - value: Button C + value: Button B + objectReference: {fileID: 0} + - target: {fileID: 1728513650105062, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} + propertyPath: m_IsActive + value: 1 objectReference: {fileID: 0} - target: {fileID: 114344768413473294, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} @@ -814,7 +855,9 @@ PrefabInstance: value: 102 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 05f32eddd3e41fd4597ada617b785928, type: 3} --- !u!224 &1467932573 stripped RectTransform: @@ -852,6 +895,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} m_Name: m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 m_MoveRepeatDelay: 0.5 m_MoveRepeatRate: 0.1 m_XRTrackingOrigin: {fileID: 0} @@ -902,26 +946,30 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1554469708} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1763776550 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - serializedVersion: 2 + serializedVersion: 3 m_TransformParent: {fileID: 1993296955} m_Modifications: - target: {fileID: 1613174875475300, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} propertyPath: m_Name value: RightStick objectReference: {fileID: 0} + - target: {fileID: 1613174875475300, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 114017654419583406, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} propertyPath: m_Text @@ -1023,7 +1071,9 @@ PrefabInstance: value: -129 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f77f88b14a477764bb65a49d28c02d33, type: 3} --- !u!224 &1763776551 stripped RectTransform: @@ -1043,6 +1093,7 @@ GameObject: - component: {fileID: 1993296954} - component: {fileID: 1993296953} - component: {fileID: 1993296952} + - component: {fileID: 1993296956} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -1107,6 +1158,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 0 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -1131,13 +1183,26 @@ RectTransform: - {fileID: 223523015} - {fileID: 1763776551} m_Father: {fileID: 0} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!114 &1993296956 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1993296951} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 08d714a194a0b45898f07b750bc13dd3, type: 3} + m_Name: + m_EditorClassIdentifier: + inputActions: {fileID: -944628639613478452, guid: fb4d9a5521a4f4362ab71f15991a9d03, + type: 3} --- !u!850595691 &2075976824 LightingSettings: m_ObjectHideFlags: 0 @@ -1145,7 +1210,7 @@ LightingSettings: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: Settings.lighting - serializedVersion: 5 + serializedVersion: 6 m_GIWorkflowMode: 1 m_EnableBakedLightmaps: 0 m_EnableRealtimeLightmaps: 0 @@ -1154,7 +1219,7 @@ LightingSettings: m_AlbedoBoost: 1 m_IndirectOutputScale: 1 m_UsingShadowmask: 1 - m_BakeBackend: 0 + m_BakeBackend: 1 m_LightmapMaxSize: 1024 m_BakeResolution: 40 m_Padding: 2 @@ -1201,3 +1266,11 @@ LightingSettings: m_PVRFilteringAtrousPositionSigmaAO: 1 m_PVRTiledBaking: 0 m_NumRaysToShootPerTexel: -1 + m_RespectSceneVisibilityWhenBakingGI: 0 +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 519420032} + - {fileID: 1993296955} + - {fileID: 1554469711} diff --git a/Assets/Samples/OnScreenControls/OnScreenControlsSampleActions.inputactions b/Assets/Samples/OnScreenControls/OnScreenControlsSampleActions.inputactions new file mode 100644 index 0000000000..483e7fb507 --- /dev/null +++ b/Assets/Samples/OnScreenControls/OnScreenControlsSampleActions.inputactions @@ -0,0 +1,174 @@ +{ + "name": "OnScreenControlsSampleActions", + "maps": [ + { + "name": "OnScreenActions", + "id": "772d6a2a-28b2-4410-b6a1-2ee8bdfce79b", + "actions": [ + { + "name": "X", + "type": "Button", + "id": "8ea37b03-5395-4635-a449-d0c0eae8dba2", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Y", + "type": "Button", + "id": "5517acaf-e9ad-4a80-85f2-e980507a9975", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "A", + "type": "Button", + "id": "f1c85ee2-6cca-4b1e-b333-5a4af63ec80b", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "B", + "type": "Button", + "id": "5c77404a-9405-474b-9ece-a9111e48946e", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Left Stick", + "type": "Value", + "id": "c2fb729f-5485-4790-a82b-7741c1194155", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Right Stick", + "type": "Value", + "id": "94fe337f-c56d-4cd7-b840-6ebe5110fd6d", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Switch To Update Mode 1", + "type": "Button", + "id": "df032eaa-6a00-4e76-bb99-c591f6441ebb", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Switch To Update Mode 2", + "type": "Button", + "id": "06aae2f0-1f25-4e65-b32d-3d1ad547c6ba", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "", + "id": "19fbcc4b-8514-42bb-9c55-494994a21d9b", + "path": "/buttonWest", + "interactions": "", + "processors": "", + "groups": "", + "action": "X", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "bdd36c52-990c-487f-ae68-4a9aec73a464", + "path": "/buttonNorth", + "interactions": "", + "processors": "", + "groups": "", + "action": "Y", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "88d53996-7ab7-44e7-9660-e602c73b5539", + "path": "/buttonSouth", + "interactions": "", + "processors": "", + "groups": "", + "action": "A", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "598b01ac-d085-45e7-b027-aca3b6048f9a", + "path": "/buttonEast", + "interactions": "", + "processors": "", + "groups": "", + "action": "B", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "99c367b7-86e9-43c5-b91f-c0dd001f1765", + "path": "/leftStick", + "interactions": "", + "processors": "", + "groups": "", + "action": "Left Stick", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "ae6d4804-0117-455b-97a1-81b224304e7a", + "path": "/rightStick", + "interactions": "", + "processors": "", + "groups": "", + "action": "Right Stick", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "37fd29c6-edf6-4773-acbe-b8371ba5b2ed", + "path": "/1", + "interactions": "", + "processors": "", + "groups": "", + "action": "Switch To Update Mode 1", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "f9ae4c0e-2342-41ba-bba4-fb281e9a36a0", + "path": "/2", + "interactions": "", + "processors": "", + "groups": "", + "action": "Switch To Update Mode 2", + "isComposite": false, + "isPartOfComposite": false + } + ] + } + ], + "controlSchemes": [] +} \ No newline at end of file diff --git a/Assets/Samples/OnScreenControls/OnScreenControlsSampleActions.inputactions.meta b/Assets/Samples/OnScreenControls/OnScreenControlsSampleActions.inputactions.meta new file mode 100644 index 0000000000..c68f85e02b --- /dev/null +++ b/Assets/Samples/OnScreenControls/OnScreenControlsSampleActions.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: fb4d9a5521a4f4362ab71f15991a9d03 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 0 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 2f0a7c5b14..683c5f4b7e 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -35,10 +35,11 @@ however, it has to be formatted properly to pass verification tests. - Fixed case [ISXB-580](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-580) (UI Submit / Cancel not working with Switch Pro controller) by adding "Submit" & "Cancel" usages to the Switch Pro controller input controls. - Fixed an issue where undoing deletion of Action Maps did not restore Actions correctly. - Fixed case [ISXB-628](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-628) (OnIMECompositionChange does not return an empty string on accept when using Microsoft IME) by clarifying expectations and intended usage for the IME composition change event. -- Fixed case [ISX-1626](https://jira.unity3d.com/browse/ISX-1626) where the expanded/collapsed state of items in the input action editor was not properly saved between rebuilds of the UI. -- Fixed case [ISX-1668] (The Profiler shows incorrect data and spams the console with "Missing Profiler.EndSample" errors when there is an Input System Component in Scene). -- Fixed [ISX-1661](https://jira.unity3d.com/browse/ISX-1661) where undoing duplications of action maps caused console errors +- Fixed issue where the expanded/collapsed state of items in the input action editor was not properly saved between rebuilds of the UI. +- Fixed issue where The Profiler shows incorrect data and spams the console with "Missing Profiler.EndSample" errors when there is an Input System Component in Scene). +- Fixed an issue where undoing duplications of action maps caused console errors. - Fix for BindingSyntax `WithInteraction()` which was incorrectly using processors. +- Fix for UITK Input Action Editor binding 'Listen' button which wasn't working in the case for Control Type 'Any'. - Fixed issue of visual elements being null during editing project-wide actions in project settings which prompted console errors. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs index 0278c33645..b8bd97fd2c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs @@ -279,8 +279,11 @@ public static Command ChangeActionControlType(SerializedInputAction inputAction, { return (in InputActionsEditorState state) => { - var controlTypes = Selectors.BuildSortedControlList(inputAction.type).ToList(); - inputAction.wrappedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).stringValue = controlTypes[controlTypeIndex]; + var controlTypes = Selectors.BuildControlTypeList(inputAction.type).ToList(); + + // ISX-1650: "Any" (in index 0) should not be put into an InputAction.expectedControlType. It's expected to be null in this case. + var controlType = (controlTypeIndex == 0) ? string.Empty : controlTypes[controlTypeIndex]; + inputAction.wrappedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).stringValue = controlType; state.serializedObject.ApplyModifiedProperties(); return state; }; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss index a33b6d2b7d..b050e34c4c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss @@ -80,6 +80,13 @@ padding-bottom: 7px; } +.tree-view-item-icon{ + justify-content: center; + background-image: url("/Packages/com.unity.inputsystem/InputSystem/Editor/Icons/d_InputControl.png"); + width: 16px; + height: 16px; +} + .header { height: 22px; flex-direction: row; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml index 8948d8f9bc..bd6564b42e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml @@ -2,7 +2,7 @@