Class PlayerInput.ActionEvent
An event associated with an PlayerInput action.
Implements
Inherited Members
Namespace: UnityEngine .InputSystem
Assembly: Unity.InputSystem.dll
Syntax
[Serializable]
public class PlayerInput.ActionEvent : UnityEvent<InputAction.CallbackContext>, ISerializationCallbackReceiver
Remarks
Represents an event invoked in response to actions being triggered.
Contains the ID and name of the Input
The list of action events is specified in Player
Examples
public class MyPlayerScript : MonoBehaviour
{
void OnFireEvent(InputAction.CallbackContext context)
{
// Handle fire event
}
}
Constructors
ActionEvent()
Construct an empty action event.
Declaration
public ActionEvent()
Remarks
The event will not have an associated action.
See Also
ActionEvent(Guid, string)
Construct an action event and associated it with an action by GUID.
Declaration
public ActionEvent(Guid actionGUID, string name = null)
Parameters
Remarks
The event will be associated with the specified action.
See Also
ActionEvent(InputAction)
Construct an action event and associate it with an action.
Declaration
public ActionEvent(InputAction action)
Parameters
Type | Name | Description |
---|---|---|
Input |
action | The action to associate with the event. The action must be part of an action asset. |
Remarks
The event will be associated with the specified action. The action must be part of an action asset.
Exceptions
Type | Condition |
---|---|
Argument |
The action is |
Argument |
The action is not part of an action asset. |
See Also
Properties
actionId
Action GUID string for the action that triggered the event.
Declaration
public string actionId { get; }
Property Value
Type | Description |
---|---|
string |
See Also
actionName
Name of the action that triggered the event.
Declaration
public string actionName { get; }
Property Value
Type | Description |
---|---|
string |