Skip to content

Commit 9bf6802

Browse files
committed
API doc update
1 parent 59c7c40 commit 9bf6802

File tree

1 file changed

+56
-14
lines changed

1 file changed

+56
-14
lines changed

Packages/com.unity.inputsystem/InputSystem/Controls/ButtonControl.cs

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace UnityEngine.InputSystem.Controls
1010
/// An axis that has a trigger point beyond which it is considered to be pressed.
1111
/// </summary>
1212
/// <remarks>
13-
/// By default stored as a single bit. In that format, buttons will only yield 0
13+
/// By default, stored as a single bit. In that format, buttons will only yield 0
1414
/// and 1 as values. However, buttons return are <see cref="AxisControl"/>s and
1515
/// yield full floating-point values and may thus have a range of values. See
1616
/// <see cref="pressPoint"/> for how button presses on such buttons are handled.
@@ -46,6 +46,9 @@ public class ButtonControl : AxisControl
4646
///
4747
/// <example>
4848
/// <code>
49+
/// using UnityEngine;
50+
/// using UnityEngine.InputSystem.Controls;
51+
///
4952
/// public class MyDevice : InputDevice
5053
/// {
5154
/// [InputControl(parameters = "pressPoint=0.234")]
@@ -56,25 +59,38 @@ public class ButtonControl : AxisControl
5659
/// </code>
5760
/// </example>
5861
/// </remarks>
59-
/// <seealso cref="InputSettings.defaultButtonPressPoint"/>
60-
/// <seealso cref="pressPointOrDefault"/>
61-
/// <seealso cref="isPressed"/>
6262
public float pressPoint = -1;
6363

6464
/// <summary>
6565
/// Return <see cref="pressPoint"/> if set, otherwise return <see cref="InputSettings.defaultButtonPressPoint"/>.
6666
/// </summary>
6767
/// <value>Effective value to use for press point thresholds.</value>
68-
/// <seealso cref="InputSettings.defaultButtonPressPoint"/>
6968
public float pressPointOrDefault => pressPoint > 0 ? pressPoint : s_GlobalDefaultButtonPressPoint;
7069

7170
/// <summary>
72-
/// Default-initialize the control.
71+
/// Default-initialize the button control.
7372
/// </summary>
7473
/// <remarks>
75-
/// The default format for the control is <see cref="InputStateBlock.FormatBit"/>.
76-
/// The control's minimum value is set to 0 and the maximum value to 1.
74+
/// The default format for the button control is <see cref="InputStateBlock.FormatBit"/>.
75+
/// The button control's minimum value is set to 0 and the maximum value to 1.
76+
/// <example>
77+
/// <code>
78+
/// using UnityEngine;
79+
/// using UnityEngine.InputSystem.Controls;
80+
///
81+
/// public class ButtonControlExample : MonoBehaviour
82+
/// {
83+
/// void Start()
84+
/// {
85+
/// var myButton = new ButtonControl();
86+
/// }
87+
///
88+
/// //...
89+
/// }
90+
/// </code>
91+
/// </example>
7792
/// </remarks>
93+
/// <seealso cref="AxisControl"/>
7894
public ButtonControl()
7995
{
8096
m_StateBlock.format = InputStateBlock.FormatBit;
@@ -85,10 +101,39 @@ public ButtonControl()
85101
/// <summary>
86102
/// Whether the given value would be considered pressed for this button.
87103
/// </summary>
88-
/// <param name="value">Value for the button.</param>
104+
/// <param name="value">Value to check for if the button would be considered pressed or not.</param>
89105
/// <returns>True if <paramref name="value"/> crosses the threshold to be considered pressed.</returns>
90-
/// <seealso cref="pressPoint"/>
91-
/// <seealso cref="InputSettings.defaultButtonPressPoint"/>
106+
/// <remarks>
107+
/// The default format for the control is <see cref="InputStateBlock.FormatBit"/>.
108+
/// The control's minimum value is set to 0 and the maximum value to 1.
109+
/// See <see cref="InputSettings.defaultButtonPressPoint"/> for the default press point.
110+
/// <example>
111+
/// <code>
112+
/// using UnityEngine;
113+
/// using UnityEngine.InputSystem.Controls;
114+
///
115+
/// public class IsValueConsideredPressedExample : MonoBehaviour
116+
/// {
117+
/// void Start()
118+
/// {
119+
/// var myButton = new ButtonControl();
120+
/// var valueToTest = 0.5f;
121+
///
122+
/// if (myButton.IsValueConsideredPressed(valueToTest))
123+
/// {
124+
/// Debug.Log("myButton is considered pressed at: " + valueToTest.ToString());
125+
/// }
126+
/// else
127+
/// {
128+
/// Debug.Log("myButton is not considered pressed at: " + valueToTest.ToString());
129+
/// }
130+
/// }
131+
///
132+
/// //...
133+
/// }
134+
/// </code>
135+
/// </example>
136+
/// </remarks>
92137
[MethodImpl(MethodImplOptions.AggressiveInlining)]
93138
public new bool IsValueConsideredPressed(float value)
94139
{
@@ -149,9 +194,6 @@ public ButtonControl()
149194
/// ]]>
150195
/// </code>
151196
/// </example>
152-
/// <seealso cref="InputSettings.defaultButtonPressPoint"/>
153-
/// <seealso cref="pressPoint"/>
154-
/// <seealso cref="InputSystem.onAnyButtonPress"/>
155197
public bool isPressed
156198
{
157199
get

0 commit comments

Comments
 (0)