Skip to content

Commit 6703c57

Browse files
committed
added example for OnAdded too, uniformed the remarks section
1 parent 04a3e1b commit 6703c57

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,26 @@ public virtual void MakeCurrent()
508508
/// </summary>
509509
/// <remarks>
510510
/// This is called <em>after</em> the device has already been added.
511-
/// </remarks>
512511
/// <seealso cref="InputSystem.devices"/>
513512
/// <seealso cref="InputDeviceChange.Added"/>
514513
/// <seealso cref="OnRemoved"/>
514+
/// </remarks>
515+
/// <example>
516+
/// <code>
517+
/// using UnityEngine.InputSystem;
518+
///
519+
/// public class MyDevice : InputDevice
520+
/// {
521+
/// public static MyDevice current { get; private set; }
522+
/// protected override void OnAdded()
523+
/// {
524+
/// // use this context to assign the current device for instance
525+
/// base.OnAdded();
526+
/// current = this;
527+
/// }
528+
/// }
529+
/// </code>
530+
/// </example>
515531
protected virtual void OnAdded()
516532
{
517533
}
@@ -523,7 +539,7 @@ protected virtual void OnAdded()
523539
/// This is called <em>after</em> the device has already been removed.
524540
/// <seealso cref="InputSystem.devices"/>
525541
/// <seealso cref="InputDeviceChange.Removed"/>
526-
/// <seealso cref="OnRemoved"/>
542+
/// <seealso cref="OnAdded"/>
527543
/// </remarks>
528544
/// <example>
529545
/// <code>

0 commit comments

Comments
 (0)