@@ -58,12 +58,15 @@ namespace UnityEngine.InputSystem
5858 /// </remarks>
5959 /// <example>
6060 /// <code>
61- /// // Add a "synthetic" gamepad that isn't actually backed by hardware.
62- /// var gamepad = InputSystem.AddDevice<Gamepad>();
63- /// </code>
64- /// </example>
65- /// <example>
66- /// <code>
61+ /// using System.Runtime.InteropServices;
62+ /// using UnityEditor;
63+ /// using UnityEngine;
64+ /// using UnityEngine.InputSystem;
65+ /// using UnityEngine.InputSystem.Controls;
66+ /// using UnityEngine.InputSystem.Layouts;
67+ /// using UnityEngine.InputSystem.LowLevel;
68+ /// using UnityEngine.InputSystem.Utilities;
69+ ///
6770 /// // InputControlLayoutAttribute attribute is only necessary if you want
6871 /// // to override default behavior that occurs when registering your device
6972 /// // as a layout.
@@ -78,6 +81,9 @@ namespace UnityEngine.InputSystem
7881 /// public ButtonControl button { get; private set; }
7982 /// public AxisControl axis { get; private set; }
8083 ///
84+ /// // This is an example on how to add a "synthetic" gamepad that isn't actually backed by hardware.
85+ /// Gamepad gamepad = InputSystem.AddDevice<Gamepad>();
86+ ///
8187 /// // Register the device.
8288 /// static MyDevice()
8389 /// {
@@ -121,20 +127,20 @@ namespace UnityEngine.InputSystem
121127 /// // particular device is connected and fed into the input system.
122128 /// // The format is a simple FourCC code that "tags" state memory blocks for the
123129 /// // device to give a base level of safety checks on memory operations.
124- /// public FourCC format => return new FourCC('H', 'I', 'D');
130+ /// public FourCC format => new FourCC('H', 'I', 'D');
125131 ///
126132 /// // InputControlAttributes on fields tell the input system to create controls
127133 /// // for the public fields found in the struct.
128134 ///
129135 /// // Assume a 16bit field of buttons. Create one button that is tied to
130136 /// // bit #3 (zero-based). Note that buttons do not need to be stored as bits.
131137 /// // They can also be stored as floats or shorts, for example.
132- /// [InputControl(name = "button", layout = "Button", bit = 3)]
138+ /// [InputControl(name = "button", layout = "Button", bit = 3)] [FieldOffset(0)]
133139 /// public ushort buttons;
134140 ///
135141 /// // Create a floating-point axis. The name, if not supplied, is taken from
136142 /// // the field.
137- /// [InputControl(layout = "Axis")]
143+ /// [InputControl(layout = "Axis")] [FieldOffset(0)]
138144 /// public short axis;
139145 /// }
140146 /// </code>
0 commit comments