-
Notifications
You must be signed in to change notification settings - Fork 328
DOCS: Added PlayerInput.ActionEvent documentation #2068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
daf85a2
c2897cd
d05ace0
03b4c6f
9a6139f
9baeaf0
287709c
e618a51
5511eb6
840a017
7cce37b
b3a395b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -519,6 +519,8 @@ public PlayerNotifications notificationBehavior | |
| /// <remarks> | ||
| /// This array is only used if <see cref="notificationBehavior"/> is set to | ||
| /// <see cref="UnityEngine.InputSystem.PlayerNotifications.InvokeUnityEvents"/>. | ||
| /// | ||
| /// The list of actions will be dependent on the <see cref="InputActionAsset"/> specified in the <see cref="PlayerInputEditor"/> UI. | ||
| /// </remarks> | ||
| public ReadOnlyArray<ActionEvent> actionEvents | ||
| { | ||
|
|
@@ -1978,19 +1980,54 @@ private void SwitchControlSchemeInternal(ref InputControlScheme controlScheme, p | |
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// An event associated with an PlayerInput action. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Represents an event invoked in response to actions being triggered. | ||
| /// | ||
| /// Contains the Id and name of the action being triggered and the associated UnityAction to handle the action response. | ||
| /// </remarks> | ||
| /// <example> | ||
| /// <code> | ||
lyndon-unity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// </code> | ||
| /// </example> | ||
| /// <seealso cref="PlayerInput.actionEvents"/> | ||
lyndon-unity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [Serializable] | ||
| public class ActionEvent : UnityEvent<InputAction.CallbackContext> | ||
| { | ||
| /// <summary> | ||
| /// Action GUID string for the action that triggered the event. | ||
| /// </summary> | ||
| public string actionId => m_ActionId; | ||
|
|
||
| /// <summary> | ||
| /// Name of the action that triggered the event. | ||
| /// </summary> | ||
| public string actionName => m_ActionName; | ||
|
|
||
| [SerializeField] private string m_ActionId; | ||
| [SerializeField] private string m_ActionName; | ||
|
|
||
| /// <summary> | ||
| /// Construct an empty action event. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The event will not have an associated action. | ||
| /// </remarks> | ||
| public ActionEvent() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct an action event and associated it with an action. | ||
lyndon-unity marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| /// <remarks> | ||
| /// The event will be associated with the specified action. The action must be part of an action asset. | ||
| /// </remarks> | ||
| /// <param name="action">The action to associate with the event. The action must be part of an action asset.</param> | ||
| /// <exception cref="ArgumentNullException">The action is null.</exception> | ||
|
||
| /// <exception cref="ArgumentException">The action is not part of an action asset.</exception> | ||
| public ActionEvent(InputAction action) | ||
| { | ||
| if (action == null) | ||
|
|
@@ -2004,6 +2041,14 @@ public ActionEvent(InputAction action) | |
| m_ActionName = $"{action.actionMap.name}/{action.name}"; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Construct an action event and associated it with an action by GUID. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The event will be associated with the specified action. | ||
| /// </remarks> | ||
| /// <param name="actionGUID">Action GUID</param> | ||
lyndon-unity marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// <param name="name">name of the action</param> | ||
lyndon-unity marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public ActionEvent(Guid actionGUID, string name = null) | ||
| { | ||
| m_ActionId = actionGUID.ToString(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.