Class InputActionReference
References a specific InputAction in an InputActionMap stored inside an InputActionAsset.
Inheritance
System.Object
InputActionReference
Namespace: UnityEngine.InputSystem
Syntax
public class InputActionReference : ScriptableObject
Remarks
The difference to a plain reference directly to an InputAction object is that an InputActionReference can be serialized without causing the referenced InputAction to be serialized as well. The reference will remain intact even if the action or the map that contains the action is renamed.
References can be set up graphically in the editor by dropping individual actions from the project browser onto a reference field.
Properties
action
The action that the reference resolves to.
Declaration
public InputAction action { get; }
Property Value
Type | Description |
---|---|
InputAction |
Remarks
Actions are resolved on demand based on their internally stored IDs.
asset
The asset that the referenced action is part of.
Declaration
public InputActionAsset asset { get; }
Property Value
Type | Description |
---|---|
InputActionAsset |
Methods
Create(InputAction)
Declaration
public static InputActionReference Create(InputAction action)
Parameters
Type | Name | Description |
---|---|---|
InputAction | action |
Returns
Type | Description |
---|---|
InputActionReference |
Set(InputAction)
Declaration
public void Set(InputAction action)
Parameters
Type | Name | Description |
---|---|---|
InputAction | action |
Set(InputActionAsset, String, String)
Declaration
public void Set(InputActionAsset asset, string mapName, string actionName)
Parameters
Type | Name | Description |
---|---|---|
InputActionAsset | asset | |
System.String | mapName | |
System.String | actionName |
ToInputAction()
Declaration
public InputAction ToInputAction()
Returns
Type | Description |
---|---|
InputAction |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Operators
Implicit(InputActionReference to InputAction)
Declaration
public static implicit operator InputAction(InputActionReference reference)
Parameters
Type | Name | Description |
---|---|---|
InputActionReference | reference |
Returns
Type | Description |
---|---|
InputAction |