1515using UnityEngine . InputSystem ;
1616using UnityEngine . InputSystem . Utilities ;
1717
18+ /// <summary>
19+ /// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Samples/SimpleDemo/SimpleControls.inputactions".
20+ /// </summary>
21+ /// <remarks>
22+ /// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
23+ /// </remarks>
24+ /// <example>
25+ /// <code>
26+ /// using namespace UnityEngine;
27+ /// using UnityEngine.InputSystem;
28+ ///
29+ /// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
30+ /// public class Example : MonoBehaviour, MyActions.IPlayerActions
31+ /// {
32+ /// private MyActions_Actions m_Actions; // Source code representation of asset.
33+ /// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
34+ ///
35+ /// void Awake()
36+ /// {
37+ /// m_Actions = new MyActions_Actions(); // Create asset object.
38+ /// m_Player = m_Actions.Player; // Extract action map object.
39+ /// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
40+ /// }
41+ ///
42+ /// void OnDestroy()
43+ /// {
44+ /// m_Actions.Dispose(); // Destroy asset object.
45+ /// }
46+ ///
47+ /// void OnEnable()
48+ /// {
49+ /// m_Player.Enable(); // Enable all actions within map.
50+ /// }
51+ ///
52+ /// void OnDisable()
53+ /// {
54+ /// m_Player.Disable(); // Disable all actions within map.
55+ /// }
56+ ///
57+ /// #region Interface implementation of MyActions.IPlayerActions
58+ ///
59+ /// // Invoked when "Move" action is either started, performed or canceled.
60+ /// public void OnMove(InputAction.CallbackContext context)
61+ /// {
62+ /// Debug.Log($"OnMove: {context.ReadValue<Vector2>()}");
63+ /// }
64+ ///
65+ /// // Invoked when "Attack" action is either started, performed or canceled.
66+ /// public void OnAttack(InputAction.CallbackContext context)
67+ /// {
68+ /// Debug.Log($"OnAttack: {context.ReadValue<float>()}");
69+ /// }
70+ ///
71+ /// #endregion
72+ /// }
73+ /// </code>
74+ /// </example>
1875public partial class @SimpleControls : IInputActionCollection2 , IDisposable
1976{
77+ /// <summary>
78+ /// Provides access to the underlying asset instance.
79+ /// </summary>
2080 public InputActionAsset asset { get ; }
81+
82+ /// <summary>
83+ /// Constructs a new instance.
84+ /// </summary>
2185 public @SimpleControls ( )
2286 {
2387 asset = InputActionAsset . FromJson ( @"{
@@ -172,57 +236,71 @@ public @SimpleControls()
172236 UnityEngine . Debug . Assert ( ! m_gameplay . enabled , "This will cause a leak and performance issues, SimpleControls.gameplay.Disable() has not been called." ) ;
173237 }
174238
239+ /// <summary>
240+ /// Destroys this asset and all associated <see cref="InputAction"/> instances.
241+ /// </summary>
175242 public void Dispose ( )
176243 {
177244 UnityEngine . Object . Destroy ( asset ) ;
178245 }
179246
247+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
180248 public InputBinding ? bindingMask
181249 {
182250 get => asset . bindingMask ;
183251 set => asset . bindingMask = value ;
184252 }
185253
254+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
186255 public ReadOnlyArray < InputDevice > ? devices
187256 {
188257 get => asset . devices ;
189258 set => asset . devices = value ;
190259 }
191260
261+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
192262 public ReadOnlyArray < InputControlScheme > controlSchemes => asset . controlSchemes ;
193263
264+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
194265 public bool Contains ( InputAction action )
195266 {
196267 return asset . Contains ( action ) ;
197268 }
198269
270+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
199271 public IEnumerator < InputAction > GetEnumerator ( )
200272 {
201273 return asset . GetEnumerator ( ) ;
202274 }
203275
276+ /// <inheritdoc cref="IEnumerable.GetEnumerator()" />
204277 IEnumerator IEnumerable . GetEnumerator ( )
205278 {
206279 return GetEnumerator ( ) ;
207280 }
208281
282+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
209283 public void Enable ( )
210284 {
211285 asset . Enable ( ) ;
212286 }
213287
288+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
214289 public void Disable ( )
215290 {
216291 asset . Disable ( ) ;
217292 }
218293
294+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
219295 public IEnumerable < InputBinding > bindings => asset . bindings ;
220296
297+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
221298 public InputAction FindAction ( string actionNameOrId , bool throwIfNotFound = false )
222299 {
223300 return asset . FindAction ( actionNameOrId , throwIfNotFound ) ;
224301 }
225302
303+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
226304 public int FindBinding ( InputBinding bindingMask , out InputAction action )
227305 {
228306 return asset . FindBinding ( bindingMask , out action ) ;
@@ -234,18 +312,51 @@ public int FindBinding(InputBinding bindingMask, out InputAction action)
234312 private readonly InputAction m_gameplay_fire ;
235313 private readonly InputAction m_gameplay_move ;
236314 private readonly InputAction m_gameplay_look ;
315+ /// <summary>
316+ /// Provides access to input actions defined in input action map "gameplay".
317+ /// </summary>
237318 public struct GameplayActions
238319 {
239320 private @SimpleControls m_Wrapper ;
321+
322+ /// <summary>
323+ /// Construct a new instance of the input action map wrapper class.
324+ /// </summary>
240325 public GameplayActions ( @SimpleControls wrapper ) { m_Wrapper = wrapper ; }
326+ /// <summary>
327+ /// Provides access to the underlying input action "gameplay/fire".
328+ /// </summary>
241329 public InputAction @fire => m_Wrapper . m_gameplay_fire ;
330+ /// <summary>
331+ /// Provides access to the underlying input action "gameplay/move".
332+ /// </summary>
242333 public InputAction @move => m_Wrapper . m_gameplay_move ;
334+ /// <summary>
335+ /// Provides access to the underlying input action "gameplay/look".
336+ /// </summary>
243337 public InputAction @look => m_Wrapper . m_gameplay_look ;
338+ /// <summary>
339+ /// Provides access to the underlying input action map instance.
340+ /// </summary>
244341 public InputActionMap Get ( ) { return m_Wrapper . m_gameplay ; }
342+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
245343 public void Enable ( ) { Get ( ) . Enable ( ) ; }
344+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
246345 public void Disable ( ) { Get ( ) . Disable ( ) ; }
346+ /// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
247347 public bool enabled => Get ( ) . enabled ;
348+ /// <summary>
349+ /// Implicitly converts an <see ref="GameplayActions" /> to an <see ref="InputActionMap" /> instance.
350+ /// </summary>
248351 public static implicit operator InputActionMap ( GameplayActions set ) { return set . Get ( ) ; }
352+ /// <summary>
353+ /// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
354+ /// </summary>
355+ /// <param name="instance">Callback instance.</param>
356+ /// <remarks>
357+ /// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
358+ /// </remarks>
359+ /// <seealso cref="GameplayActions" />
249360 public void AddCallbacks ( IGameplayActions instance )
250361 {
251362 if ( instance == null || m_Wrapper . m_GameplayActionsCallbackInterfaces . Contains ( instance ) ) return ;
@@ -261,6 +372,13 @@ public void AddCallbacks(IGameplayActions instance)
261372 @look . canceled += instance . OnLook ;
262373 }
263374
375+ /// <summary>
376+ /// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
377+ /// </summary>
378+ /// <remarks>
379+ /// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
380+ /// </remarks>
381+ /// <seealso cref="GameplayActions" />
264382 private void UnregisterCallbacks ( IGameplayActions instance )
265383 {
266384 @fire . started -= instance . OnFire ;
@@ -274,12 +392,25 @@ private void UnregisterCallbacks(IGameplayActions instance)
274392 @look . canceled -= instance . OnLook ;
275393 }
276394
395+ /// <summary>
396+ /// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />.
397+ /// </summary>
398+ /// <seealso cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />
277399 public void RemoveCallbacks ( IGameplayActions instance )
278400 {
279401 if ( m_Wrapper . m_GameplayActionsCallbackInterfaces . Remove ( instance ) )
280402 UnregisterCallbacks ( instance ) ;
281403 }
282404
405+ /// <summary>
406+ /// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
407+ /// </summary>
408+ /// <remarks>
409+ /// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
410+ /// </remarks>
411+ /// <seealso cref="GameplayActions.AddCallbacks(IGameplayActions)" />
412+ /// <seealso cref="GameplayActions.RemoveCallbacks(IGameplayActions)" />
413+ /// <seealso cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />
283414 public void SetCallbacks ( IGameplayActions instance )
284415 {
285416 foreach ( var item in m_Wrapper . m_GameplayActionsCallbackInterfaces )
@@ -288,11 +419,37 @@ public void SetCallbacks(IGameplayActions instance)
288419 AddCallbacks ( instance ) ;
289420 }
290421 }
422+ /// <summary>
423+ /// Provides a new <see cref="GameplayActions" /> instance referencing this action map.
424+ /// </summary>
291425 public GameplayActions @gameplay => new GameplayActions ( this ) ;
426+ /// <summary>
427+ /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "gameplay" which allows adding and removing callbacks.
428+ /// </summary>
429+ /// <seealso cref="GameplayActions.AddCallbacks(IGameplayActions)" />
430+ /// <seealso cref="GameplayActions.RemoveCallbacks(IGameplayActions)" />
292431 public interface IGameplayActions
293432 {
433+ /// <summary>
434+ /// Method invoked when associated input action "fire" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
435+ /// </summary>
436+ /// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
437+ /// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
438+ /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
294439 void OnFire ( InputAction . CallbackContext context ) ;
440+ /// <summary>
441+ /// Method invoked when associated input action "move" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
442+ /// </summary>
443+ /// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
444+ /// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
445+ /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
295446 void OnMove ( InputAction . CallbackContext context ) ;
447+ /// <summary>
448+ /// Method invoked when associated input action "look" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
449+ /// </summary>
450+ /// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
451+ /// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
452+ /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
296453 void OnLook ( InputAction . CallbackContext context ) ;
297454 }
298455}
0 commit comments