diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/InputValue.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/InputValue.cs
index c781ae9418..61cba088fb 100644
--- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/InputValue.cs
+++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/InputValue.cs
@@ -22,10 +22,10 @@ namespace UnityEngine.InputSystem
public class InputValue
{
///
- /// Read the value as an object.
+ /// Read the current value as an object.
///
///
- /// This method allocates GC memory and will thus created garbage. If used during gameplay,
+ /// This method allocates GC memory and will thus create garbage. If used during gameplay,
/// it will lead to GC spikes.
///
/// The current value in the form of a boxed object.
@@ -35,6 +35,45 @@ public object Get()
}
////TODO: add automatic conversions
+ ///
+ /// Read the current value of the action.
+ ///
+ /// The current value from the action cast to the specified type.
+ /// Type of value to read. This must correspond to the
+ /// of the action or, if it is a composite, by the
+ /// .
+ /// The type depends on what type of controls the action is bound to.
+ /// Common types are float and
+ /// The given type
+ /// does not match the value type expected by the control or binding composite.
+ ///
+ /// The following example shows how to read a value from a message.
+ /// The given InputValue is only valid for the duration of the callback. Storing the InputValue references somewhere and calling Get<T>() later does not work correctly.
+ ///
+ ///
+ ///
+ /// using UnityEngine;
+ /// using UnityEngine.InputSystem;
+ /// [RequireComponent(typeof(PlayerInput))]
+ /// public class MyPlayerLogic : MonoBehaviour
+ /// {
+ /// private Vector2 m_Move;
+ ///
+ /// // 'Move' input action has been triggered.
+ /// public void OnMove(InputValue value)
+ /// {
+ /// // Read value from control. The type depends on what type of controls the action is bound to.
+ /// m_Move = value.Get<Vector2>();
+ /// }
+ ///
+ /// public void Update()
+ /// {
+ /// // Update transform from m_Move
+ /// }
+ /// }
+ ///
+ ///
+ ///
public TValue Get()
where TValue : struct
{
@@ -45,6 +84,34 @@ public TValue Get()
}
////TODO: proper message if value type isn't right
+ ///
+ /// Check if the action button is pressed.
+ ///
+ ///
+ /// True if the button is activated over the button threshold. False otherwise
+ /// The following example check if a button is pressed when receiving a message.
+ /// The given InputValue is only valid for the duration of the callback. Storing the InputValue references somewhere and calling Get<T>() later does not work correctly.
+ ///
+ ///
+ ///
+ /// [RequireComponent(typeof(PlayerInput))]
+ /// public class MyPlayerLogic : MonoBehaviour
+ /// {
+ /// // 'Fire' input action has been triggered.
+ /// public void OnFire(InputValue value)
+ /// {
+ /// if (value.isPressed)
+ /// FireWeapon();
+ /// }
+ ///
+ /// public void FireWeapon()
+ /// {
+ /// // Weapon firing code
+ /// }
+ /// }
+ ///
+ ///
+ ///
public bool isPressed => Get() >= ButtonControl.s_GlobalDefaultButtonPressPoint;
internal InputAction.CallbackContext? m_Context;