You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Packages/com.unity.inputsystem/CHANGELOG.md
+14-10Lines changed: 14 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -468,7 +468,7 @@ however, it has to be formatted properly to pass verification tests.
468
468
- Fixed issue of visual elements being null during editing project-wide actions in project settings which prompted console errors.
469
469
- Fixed case ISX-1436 (UI TK Input Action Asset Editor - Error deleting Bindings with DeleteKey on Windows).
470
470
- Fixed issue with UI Toolkit based Input Action Editor not restoring it's selected items after Domain Reload.
471
-
- Fixed the [`GetHapticCapabilitiesCommand`](xref:UnityEngine.InputSystem.XR.Haptics.GetHapticCapabilitiesCommand) always failing to execute due to a mismatch in the size in bytes of the payload and the size expected by XR devices. Changed [`HapticCapabilities`](xref:UnityEngine.InputSystem.XR.Haptics.HapticCapabilities) to include all properties returned by the XR input subsystem. This makes Input System match the functionality provided by the [XR](https://docs.unity3d.com/Manual/com.unity.modules.xr.html) module's [`InputDevice.TryGetHapticCapabilities`](https://docs.unity3d.com/ScriptReference/XR.InputDevice.TryGetHapticCapabilities.html) and [`HapticCapabilities`](https://docs.unity3d.com/ScriptReference/XR.HapticCapabilities.html).
471
+
- Fixed the [`GetHapticCapabilitiesCommand`](xref:UnityEngine.InputSystem.XR.Haptics.GetHapticCapabilitiesCommand) always failing to execute due to a mismatch in the size in bytes of the payload and the size expected by XR devices. Changed [`HapticCapabilities`](xref:UnityEngine.InputSystem.XR.Haptics.HapticCapabilities) to include all properties returned by the XR input subsystem. This makes Input System match the functionality provided by the [XR](https://docs.unity3d.com/Manual/com.unity.modules.xr.html) module's [`InputDevice.TryGetHapticCapabilities`](xref:UnityEngine.XR.InputDevice.TryGetHapticCapabilities(UnityEngine.XR.HapticCapabilities&)) and [`HapticCapabilities`](xref:UnityEngine.XR.HapticCapabilities).
472
472
- Fixed issue where deleting a binding in the Input Action Editor would usually result in an unexpected item being selected next.
473
473
474
474
## [1.8.0-pre.1] - 2023-09-04
@@ -1904,7 +1904,8 @@ This release includes a number of Quality-of-Life improvements for a range of co
-[Type-safe C# API Generation](#type-safe-c-api-generation)
6
+
An input action asset is an asset which contains a set of [input action](xref:input-system-actions) definitions and their associated [Bindings](xref:input-system-action-bindings) and [control schemes](xref:input-system-action-bindings#control-schemes). These assets have the `.inputactions` file extension and are stored in a plain JSON format.
10
7
11
-
An Input Action Asset is an Asset which contains a set of [Input Actions](Actions.md) definitions and their associated [Bindings](ActionBindings.md) and [Control Schemes](ActionBindings.md#control-schemes). These Assets have the `.inputactions` file extension and are stored in a plain JSON format.
8
+
The input system creates an action asset when you set up the [default project-wide actions](xref:project-wide-actions), but you can also create new action assets directly in the Project window.
12
9
13
-
The input system creates an Action Asset when you set up the [default project-wide actions](ProjectWideActions.md), but you can also create new Action Assets directly in the Project window.
10
+
For most common scenarios, you do not need to use more than one input action asset. It is usually simpler to configure your project-wide action definition in the Project Settings window.
14
11
15
-
For most common scenarios, you do not need to use more than one Input Action Asset. It is usually simpler to configure your project-wide action definition in the Project Settings window.
16
12
13
+
## Creating input action assets
17
14
18
-
## Creating Input Action Assets
15
+
To create an asset that contains [input actions](xref:input-system-actions) in Unity, right-click in the __Project__ window or go to __Assets > Create > Input Actions__ from Unity's main menu.
19
16
20
-
To create an Asset that contains [Input Actions](Actions.md) in Unity, right-click in the __Project__ window or go to __Assets > Create > Input Actions__ from Unity's main menu.
17
+
## Editing input action assets
21
18
22
-
## Editing Input Action Assets
19
+
To open the Input Actions Editor, double-click an `.inputactions` asset in the Project Browser, or select the __Edit Asset__ button in the Inspector for that asset. You can have more than one editor window open at the same time, but not for the same asset.
23
20
24
-
To bring up the Action editor, double-click an `.inputactions` Asset in the Project Browser, or select the __Edit Asset__ button in the Inspector for that Asset. You can have more than one editor window open at the same time, but not for the same Asset.
21
+
This Input Actions Editor is identical to the one that opens in the [Project Settings window](xref:input-system-configuring-input).
25
22
26
-
The Actions Editor which opens is identical to the [Actions Editor in the Project Settings window](ActionsEditor.md).
27
23
24
+
## Using input action assets
28
25
29
-
## Using Input Action Assets
30
26
27
+
## Type-safe C# API generation
31
28
32
-
## Type-safe C# API Generation
29
+
Input action assets allow you to **generate a C# class** from your action definitions, so you can refer to your actions in a type-safe manner from code. This means you can avoid looking up your actions by string.
33
30
34
-
Input Action Assets allow you to **generate a C# class** from your action definitions, which allow you to refer to your actions in a type-safe manner from code. This means you can avoid looking up your actions by string.
31
+
### Auto-generating script code for actions
35
32
36
-
### Auto-generating script code for Actions
33
+
One of the most convenient ways to work with `.inputactions` assets in scripts is to automatically generate a C# wrapper class for them. This provides an easier way to set up callbacks and avoid manually looking up actions and action maps by name.
37
34
38
-
One of the most convenient ways to work with `.inputactions` Assets in scripts is to automatically generate a C# wrapper class for them. This removes the need to manually look up Actions and Action Maps using their names, and also provides an easier way to set up callbacks.
35
+
To enable this option, enable the __Generate C# Class__ property in the input action asset's Inspector, then select __Apply__.
39
36
40
-
To enable this option, tick the __Generate C# Class__ checkbox in the importer properties in the Inspector of the `.inputactions` Asset, then select __Apply__.

43
38
44
39
You can optionally choose a path name, class name, and namespace for the generated script, or keep the default values.
45
40
46
-
This generates a C# script that simplifies working with the Asset.
41
+
This generates a C# script that simplifies working with the asset.
47
42
48
43
```CSharp
49
44
usingUnityEngine;
50
45
usingUnityEngine.InputSystem;
51
46
52
-
// IGameplayActions is an interface generated from the "gameplay" action map
53
-
//we added (note that if you called the action map differently, the name of
54
-
//the interface will be different). This was triggered by the "Generate Interfaces"
55
-
//checkbox.
47
+
// IGameplayActions is an interface generated from the newly added "gameplay"
48
+
//action map, triggered by the "Generate Interfaces" checkbox. Note that if
49
+
//you change the default values for the action map, the name of the interface
// MyPlayerControls is the C# class that Unity generated.
@@ -65,8 +60,8 @@ public class MyPlayerScript : MonoBehaviour, IGameplayActions
65
60
if (controls==null)
66
61
{
67
62
controls=newMyPlayerControls();
68
-
// Tell the "gameplay" action map that we want to get told about
69
-
// when actions get triggered.
63
+
// Tell the "gameplay" action map that we want to be
64
+
//notified when actions get triggered.
70
65
controls.gameplay.SetCallbacks(this);
71
66
}
72
67
controls.gameplay.Enable();
@@ -90,21 +85,26 @@ public class MyPlayerScript : MonoBehaviour, IGameplayActions
90
85
}
91
86
```
92
87
93
-
>__Note__: To regenerate the .cs file, right-click the .inputactions asset in the Project Browser and choose "Reimport".
88
+
> [!NOTE]
89
+
> To regenerate the .cs file, right-click the .inputactions asset in the Project window and choose "Reimport".
90
+
91
+
### Using action assets with `PlayerInput`
94
92
95
-
### Using Action Assets with `PlayerInput`
93
+
The [Player Input](xref:input-system-player-input) component provides a convenient way to handle input for one or multiple players. You can assign your action asset to the Player Input component so that it can then automatically handle activating action maps and selecting control schemes for you.
96
94
97
-
The [Player Input](PlayerInput.md) component provides a convenient way to handle input for one or multiple players. You can assign your Action Asset to the Player Input component so that it can then automatically handle activating Action Maps and selecting Control Schemes for you.
95
+

98
96
99
-

97
+
### Modifying input action assets at runtime
100
98
101
-
### Modifying Input Action Assets at runtime
102
-
There are several ways to modify an Input Action Asset at runtime. Any modifications that you make during Play mode to an Input Action Asset do not persist in the Input Action Asset after you exit Play mode. This means you can test your application in a realistic manner in the Editor without having to worry about inadvertently modifying the asset. For examples on how to modify an Input Action Asset, see the documentation on [Creating Actions in code](Actions.md#creating-actions-in-code) and [Changing Bindings](ActionBindings.md#changing-bindings).
99
+
There are several ways to modify an input action asset at runtime. Any modifications that you make during Play mode to an input action asset do not persist in the asset after you exit Play mode. This means you can test your application in a realistic way in the Editor without having to worry about inadvertently modifying the asset. For examples on how to modify an input action asset, refer to [Create actions in code](xref:input-system-actions#create-actions-in-code) and [Change Bindings](xref:input-system-action-bindings#change-bindings).
103
100
104
101
105
-
### The Default Actions Asset
102
+
### The default actions asset
106
103
107
-
An asset called `DefaultInputActions.inputactions` containing a default setup of Actions comes with the Input System Package. You can reference this asset directly in your projects like any other Unity asset. However, the asset is also available in code form through the [`DefaultInputActions`](../api/UnityEngine.InputSystem.DefaultInputActions.html) class.
104
+
> [!NOTE]
105
+
> The default actions asset is entirely separate from the [default project-wide actions](xref:project-wide-actions). It is a legacy asset that is included in the package for backwards compatibility.
106
+
107
+
The Input System package provides an asset called `DefaultInputActions.inputactions` which you can reference directly in your projects like any other Unity asset. The asset is also available in code form through the [`DefaultInputActions`](xref:UnityEngine.InputSystem.DefaultInputActions) class.
108
108
109
109
```CSharp
110
110
voidStart()
@@ -116,5 +116,3 @@ void Start()
116
116
actions.Enable();
117
117
}
118
118
```
119
-
120
-
> __Note:__ This default actions asset is older than, and entirely separate from the [default project-wide actions](ProjectWideActions.md). It is a legacy asset that remains included in the package for backward compatibility.
0 commit comments