Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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>
/// </code>
/// </example>
/// <seealso cref="PlayerInput.actionEvents"/>
[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.
/// </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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe null should have formatting here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill add < c > around the null. I assume these whats meant.

I don't understand the '?' query

/// <exception cref="ArgumentException">The action is not part of an action asset.</exception>
public ActionEvent(InputAction action)
{
if (action == null)
Expand All @@ -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>
/// <param name="name">name of the action</param>
public ActionEvent(Guid actionGUID, string name = null)
{
m_ActionId = actionGUID.ToString();
Expand Down
Loading