Class SceneInputActions
Provides programmatic access to UnityEngine.InputSystem.InputActionAsset, UnityEngine.InputSystem.InputActionMap, UnityEngine.InputSystem.InputAction and UnityEngine.InputSystem.InputControlScheme instances defined in asset "Packages/com.nwh.common/Runtime/Input/InputSystem/SceneInputActions.inputactions".
Inheritance
SceneInputActions
Implements
IInputActionCollection2
IInputActionCollection
Assembly: NWH.Common.dll
public class SceneInputActions : IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable, IDisposable
using namespace UnityEngine;
using UnityEngine.InputSystem;
// Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
public class Example : MonoBehaviour, MyActions.IPlayerActions
{
private MyActions_Actions m_Actions; // Source code representation of asset.
private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
void Awake()
{
m_Actions = new MyActions_Actions(); // Create asset object.
m_Player = m_Actions.Player; // Extract action map object.
m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
}
void OnDestroy()
{
m_Actions.Dispose(); // Destroy asset object.
}
void OnEnable()
{
m_Player.Enable(); // Enable all actions within map.
}
void OnDisable()
{
m_Player.Disable(); // Disable all actions within map.
}
#region Interface implementation of MyActions.IPlayerActions
// Invoked when "Move" action is either started, performed or canceled.
public void OnMove(InputAction.CallbackContext context)
{
Debug.Log($"OnMove: {context.ReadValue<Vector2>()}");
}
// Invoked when "Attack" action is either started, performed or canceled.
public void OnAttack(InputAction.CallbackContext context)
{
Debug.Log($"OnAttack: {context.ReadValue<float>()}");
}
#endregion
}
Constructors
|
Edit this page
View Source
Constructs a new instance.
Declaration
public SceneInputActions()
Properties
|
Edit this page
View Source
Declaration
public SceneInputActions.CameraControlsActions CameraControls { get; }
Property Value
|
Edit this page
View Source
Declaration
public SceneInputActions.SceneControlsActions SceneControls { get; }
Property Value
|
Edit this page
View Source
Provides access to the underlying asset instance.
Declaration
public InputActionAsset asset { get; }
Property Value
| Type |
Description |
| InputActionAsset |
|
|
Edit this page
View Source
Declaration
public InputBinding? bindingMask { get; set; }
Property Value
| Type |
Description |
| InputBinding? |
|
|
Edit this page
View Source
Declaration
public IEnumerable<InputBinding> bindings { get; }
Property Value
|
Edit this page
View Source
Declaration
public ReadOnlyArray<InputControlScheme> controlSchemes { get; }
Property Value
| Type |
Description |
| ReadOnlyArray<InputControlScheme> |
|
|
Edit this page
View Source
Declaration
public ReadOnlyArray<InputDevice>? devices { get; set; }
Property Value
| Type |
Description |
| ReadOnlyArray<InputDevice>? |
|
Methods
|
Edit this page
View Source
Declaration
public bool Contains(InputAction action)
Parameters
| Type |
Name |
Description |
| InputAction |
action |
|
Returns
|
Edit this page
View Source
Declaration
|
Edit this page
View Source
Destroys this asset and all associated UnityEngine.InputSystem.InputAction instances.
Declaration
|
Edit this page
View Source
Declaration
|
Edit this page
View Source
Declaration
protected ~SceneInputActions()
|
Edit this page
View Source
Declaration
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
Parameters
| Type |
Name |
Description |
| string |
actionNameOrId |
|
| bool |
throwIfNotFound |
|
Returns
| Type |
Description |
| InputAction |
|
|
Edit this page
View Source
Declaration
public int FindBinding(InputBinding bindingMask, out InputAction action)
Parameters
| Type |
Name |
Description |
| InputBinding |
bindingMask |
|
| InputAction |
action |
|
Returns
|
Edit this page
View Source
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<InputAction> GetEnumerator()
Returns
| Type |
Description |
| IEnumerator<InputAction> |
An enumerator that can be used to iterate through the collection.
|
Implements
UnityEngine.InputSystem.IInputActionCollection2
UnityEngine.InputSystem.IInputActionCollection