Skip to content

Commit ecc1f37

Browse files
committed
Added documentation for PlayerInput.ActionEvent
1 parent 05d23b8 commit ecc1f37

File tree

1 file changed

+45
-0
lines changed
  • Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput

1 file changed

+45
-0
lines changed

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ public PlayerNotifications notificationBehavior
519519
/// <remarks>
520520
/// This array is only used if <see cref="notificationBehavior"/> is set to
521521
/// <see cref="UnityEngine.InputSystem.PlayerNotifications.InvokeUnityEvents"/>.
522+
///
523+
/// The list of actions will be dependent on the <see cref="InputActionAsset"/> specified in the <see cref="PlayerInputEditor"/> UI.
522524
/// </remarks>
523525
public ReadOnlyArray<ActionEvent> actionEvents
524526
{
@@ -1978,19 +1980,54 @@ private void SwitchControlSchemeInternal(ref InputControlScheme controlScheme, p
19781980
}
19791981
}
19801982

1983+
/// <summary>
1984+
/// An event associated with an PlayerInput action.
1985+
/// </summary>
1986+
/// <remarks>
1987+
/// Represents an event invoked in response to actions being triggered.
1988+
///
1989+
/// Contains the Id and name of the action being triggered and the associated UnityAction to handle the action response.
1990+
/// </remarks>
1991+
/// <example>
1992+
/// <code>
1993+
/// </code>
1994+
/// </example>
1995+
/// <seealso cref="PlayerInput.actionEvents"/>
19811996
[Serializable]
19821997
public class ActionEvent : UnityEvent<InputAction.CallbackContext>
19831998
{
1999+
/// <summary>
2000+
/// Action GUID string for the action that triggered the event.
2001+
/// </summary>
19842002
public string actionId => m_ActionId;
2003+
2004+
/// <summary>
2005+
/// Name of the action that triggered the event.
2006+
/// </summary>
19852007
public string actionName => m_ActionName;
19862008

19872009
[SerializeField] private string m_ActionId;
19882010
[SerializeField] private string m_ActionName;
19892011

2012+
/// <summary>
2013+
/// Construct an empty action event.
2014+
/// </summary>
2015+
/// <remarks>
2016+
/// The event will not have an associated action.
2017+
/// </remarks>
19902018
public ActionEvent()
19912019
{
19922020
}
19932021

2022+
/// <summary>
2023+
/// Construct an action event and associated it with an action.
2024+
/// </summary>
2025+
/// <remarks>
2026+
/// The event will be associated with the specified action. The action must be part of an action asset.
2027+
/// </remarks>
2028+
/// <param name="action">The action to associate with the event. The action must be part of an action asset.</param>
2029+
/// <exception cref="ArgumentNullException">The action is null.</exception>
2030+
/// <exception cref="ArgumentException">The action is not part of an action asset.</exception>
19942031
public ActionEvent(InputAction action)
19952032
{
19962033
if (action == null)
@@ -2004,6 +2041,14 @@ public ActionEvent(InputAction action)
20042041
m_ActionName = $"{action.actionMap.name}/{action.name}";
20052042
}
20062043

2044+
/// <summary>
2045+
/// Construct an action event and associated it with an action by GUID.
2046+
/// </summary>
2047+
/// <remarks>
2048+
/// The event will be associated with the specified action.
2049+
/// </remarks>
2050+
/// <param name="actionGUID">Action GUID</param>
2051+
/// <param name="name">name of the action</param>
20072052
public ActionEvent(Guid actionGUID, string name = null)
20082053
{
20092054
m_ActionId = actionGUID.ToString();

0 commit comments

Comments
 (0)