Skip to content

Commit d9e3c6e

Browse files
ducketsekcoh
andauthored
DOCS: Various documentation feedback fixes (#1947)
* DOCF-4312 feedback fix * DOCF-4575 feedback fix * DOCF-4578 - fixed interactive rebinding code sample * DOCF-4734 - typo * DOCF-4849 - clarified deltacontrol docs * DeltaControl - additional docs fixes * DOCF-4883 - InputState code sample fix * DOCF-4885 - removed outdated info about timer removal * Formatting fixes --------- Co-authored-by: Håkan Sidenvall <hakan.sidenvall@unity3d.com>
1 parent f9d7240 commit d9e3c6e

6 files changed

Lines changed: 31 additions & 32 deletions

File tree

Packages/com.unity.inputsystem/Documentation~/ActionsEditor.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,6 @@ Input Action Assets can have multiple [Control Schemes](ActionBindings.md#contro
137137

138138
![Control Scheme Properties](Images/ControlSchemeProperties.png)
139139

140-
To see the Control Schemes in the Input Action Asset editor window, open the Control Scheme drop-down list in the top left of the window. This menu lets you add or remove Control Schemes to your Asset. If the Asset contains any Control Schemes, you can select a Control Scheme, and then the window only shows bindings that are associated with that Scheme. If you select a binding, you can now pick the Control Schemes for which this binding should be active in the __Properties__ view to the left of the window. When you add a new Control Scheme, or select an existing Control Scheme, and then select __Edit Control Scheme…__, you can edit the name of the Control Scheme and which devices the Scheme should be active for.
140+
To see the Control Schemes in the Input Action Asset editor window, open the Control Scheme drop-down list in the top left of the window. This menu lets you add or remove Control Schemes to your Actions Asset. If the Actions Asset contains any Control Schemes, you can select a Control Scheme, and then the window only shows bindings that are associated with that Scheme. If you select a binding, you can now pick the Control Schemes for which this binding should be active in the __Properties__ view to the left of the window.
141+
142+
When you add a new Control Scheme, or select an existing Control Scheme, and then select __Edit Control Scheme__, you can edit the name of the Control Scheme and which devices the Scheme should be active for. When you add a new Control Scheme, the "Device Type" list is empty by default (as shown above). You must add at least one type of device to this list for the Control Scheme to be functional.

Packages/com.unity.inputsystem/InputSystem/Actions/InputActionRebindingExtensions.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,12 +1298,21 @@ private static void LoadBindingOverridesFromJsonInternal(this IInputActionCollec
12981298
///
12991299
/// <example>
13001300
/// <code>
1301-
/// // A MonoBehaviour that can be hooked up to a UI.Button control.
1301+
/// using TMPro;
1302+
/// using UnityEngine;
1303+
/// using UnityEngine.InputSystem;
1304+
///
13021305
/// public class RebindButton : MonoBehaviour
13031306
/// {
1304-
/// public InputActionReference m_Action; // Reference to an action to rebind.
1305-
/// public int m_BindingIndex; // Index into m_Action.bindings for binding to rebind.
1306-
/// public Text m_DisplayText; // Text in UI that receives the binding display string.
1307+
///
1308+
/// // A MonoBehaviour that can be hooked up to a UI.Button control.
1309+
/// // This example requires you to set up a Text Mesh Pro text field,
1310+
/// // And a UI button which calls the OnClick method in this script.
1311+
///
1312+
/// public InputActionReference actionReference; // Reference to an action to rebind.
1313+
/// public int bindingIndex; // Index into m_Action.bindings for binding to rebind.
1314+
/// public TextMeshProUGUI displayText; // Text in UI that receives the binding display string.
1315+
/// private InputActionRebindingExtensions.RebindingOperation rebind;
13071316
///
13081317
/// public void OnEnable()
13091318
/// {
@@ -1312,26 +1321,20 @@ private static void LoadBindingOverridesFromJsonInternal(this IInputActionCollec
13121321
///
13131322
/// public void OnDisable()
13141323
/// {
1315-
/// m_Rebind?.Dispose();
1324+
/// rebind?.Dispose();
13161325
/// }
13171326
///
13181327
/// public void OnClick()
13191328
/// {
1320-
/// var rebind = m_Action.PerformInteractiveRebinding()
1321-
/// .WithTargetBinding(m_BindingIndex)
1322-
/// .OnComplete(_ => UpdateDisplayText())
1323-
/// .Start();
1329+
/// var rebind = actionReference.action.PerformInteractiveRebinding().WithTargetBinding(bindingIndex).OnComplete(_ => UpdateDisplayText());
1330+
/// rebind.Start();
13241331
/// }
13251332
///
13261333
/// private void UpdateDisplayText()
13271334
/// {
1328-
/// m_DisplayText.text = m_Action.GetBindingDisplayString(m_BindingIndex);
1335+
/// displayText.text = actionReference.action.GetBindingDisplayString(bindingIndex);
13291336
/// }
1330-
///
1331-
/// private void RebindingOperation m_Rebind;
13321337
/// }
1333-
///
1334-
/// rebind.Start();
13351338
/// </code>
13361339
/// </example>
13371340
///

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
namespace UnityEngine.InputSystem.Controls
55
{
66
/// <summary>
7-
/// A control representing a two-dimensional motion vector that accumulates within a frame
8-
/// and resets at the beginning of a frame.
7+
/// Delta controls are a two-dimensional motion vector that accumulate within a frame
8+
/// and reset at the beginning of a frame. You can read the values from a delta control
9+
/// using the inherited members from Vector2Control or InputControl.
910
/// </summary>
10-
/// <remarks>
11-
/// Delta controls are
12-
/// </remarks>
1311
/// <see cref="Pointer.delta"/>
1412
/// <seealso cref="Mouse.scroll"/>
1513
[Preserve]
@@ -27,7 +25,7 @@ public class DeltaControl : Vector2Control
2725
public AxisControl up { get; set; }
2826

2927
/// <summary>
30-
/// A synthetic axis representing the lower half of the Y axis value, i.e. the -1 to 1 range (inverted).
28+
/// A synthetic axis representing the lower half of the Y axis value, i.e. the 0 to -1 range (inverted).
3129
/// </summary>
3230
/// <value>Control representing the control's lower half Y axis.</value>
3331
/// <remarks>
@@ -38,7 +36,7 @@ public class DeltaControl : Vector2Control
3836
public AxisControl down { get; set; }
3937

4038
/// <summary>
41-
/// A synthetic axis representing the left half of the X axis value, i.e. the -1 to 1 range (inverted).
39+
/// A synthetic axis representing the left half of the X axis value, i.e. the 0 to -1 range (inverted).
4240
/// </summary>
4341
/// <value>Control representing the control's left half X axis.</value>
4442
/// <remarks>

Packages/com.unity.inputsystem/InputSystem/Devices/Sensor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected override void FinishSetup()
194194
/// Input device representing a gyroscope sensor.
195195
/// </summary>
196196
/// <remarks>
197-
/// A gyroscope let's you measure the angular velocity of a device, and can be useful to control content by rotating a device.
197+
/// A gyroscope lets you measure the angular velocity of a device, and can be useful to control content by rotating a device.
198198
/// </remarks>
199199
[InputControlLayout(stateType = typeof(GyroscopeState))]
200200
public class Gyroscope : Sensor

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public enum PlayerJoinBehavior
2727
/// are involved. While initial engagement required by <see cref="JoinPlayersWhenButtonIsPressed"/> or
2828
/// <see cref="JoinPlayersWhenJoinActionIsTriggered"/> allows pairing a single device reliably to a player,
2929
/// additional devices that may be required by a control scheme will still get paired automatically out of the
30-
/// pool of available devices. This means that, for example, if a given player joins by clicking a mouse button
31-
/// ...
30+
/// pool of available devices.
3231
/// </remarks>
3332
JoinPlayersManually,
3433
}

Packages/com.unity.inputsystem/InputSystem/State/InputState.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,17 @@ public static bool IsIntegerFormat(this FourCC format)
180180
/// InputState.AddChangeMonitor(Mouse.current.rightButton, this, monitorIndex: 2);
181181
/// }
182182
///
183-
/// public void NotifyControlStateChanged(InputControl control, double time, InputEventPtr eventPtr, long monitorIndex)
183+
/// public void NotifyControlStateChanged(InputControl control, double currentTime, InputEventPtr eventPtr, long monitorIndex)
184184
/// {
185185
/// Debug.Log($"{control} changed");
186186
///
187187
/// // We can add a monitor timeout that will trigger in case the state of the
188188
/// // given control is not changed within the given time. Let's watch the control
189189
/// // for 2 seconds. If nothing happens, we will get a call to NotifyTimerExpired.
190-
/// // If, however, there is a state change, the timeout is automatically removed
191-
/// // and we will see a call to NotifyControlStateChanged instead.
192-
/// InputState.AddChangeMonitorTimeout(control, this, 2);
190+
/// InputState.AddChangeMonitorTimeout(control, this, currentTime + 2);
193191
/// }
194192
///
195-
/// public void NotifyTimerExpired(InputControl control, double time, long monitorIndex, int timerIndex)
193+
/// public void NotifyTimerExpired(InputControl control, double currentTime, long monitorIndex, int timerIndex)
196194
/// {
197195
/// Debug.Log($"{control} was not changed within 2 seconds");
198196
/// }
@@ -248,8 +246,7 @@ public static void RemoveChangeMonitor(InputControl control, IInputStateChangeMo
248246
/// <remarks>
249247
/// If by the given <paramref name="time"/>, no state change has been registered on the control monitored
250248
/// by the given <paramref name="monitor">state change monitor</paramref>, <see cref="IInputStateChangeMonitor.NotifyTimerExpired"/>
251-
/// will be called on <paramref name="monitor"/>. If a state change happens by the given <paramref name="time"/>,
252-
/// the monitor is notified as usual and the timer is automatically removed.
249+
/// will be called on <paramref name="monitor"/>.
253250
/// </remarks>
254251
public static void AddChangeMonitorTimeout(InputControl control, IInputStateChangeMonitor monitor, double time, long monitorIndex = -1, int timerIndex = -1)
255252
{

0 commit comments

Comments
 (0)