-
-
Notifications
You must be signed in to change notification settings - Fork 0
IL_LayeredAction
Namespace: namespace Lowry.UI.InputLayers
public sealed class IL_LayeredAction : MonoBehaviourFor use in the Inspector only.
Allows the use of LayeredActions in the Unity inspector.
This script is designed to expose a LayeredAction in the Unity Inspector.
It lets you assign a Unity InputAction🔗 to a specific IL_Layer, and then control both the layer and InputAction through configuring its fields in the inspector and by calling its public methods.
Along with the IL_LayerToggle script, it lets you make full use of InputLayers directly from within the Unity Editor interface.
private LayeredAction _layeredAction;Defines the InputAction🔗 that will trigger the _onEventTriggered IF the correct IL_Layer is active.
private ActionEventType _eventTypeUsed = ActionEventType.performed;Determines whether _onEventTriggered will trigger when the _layeredAction's onStartedEvent, onPerformedEvent or onCanceledEvent is called.
private UnityEvent _onEventTriggered;Will be triggered when _layeredAction's event corresponding to the value of _eventTypeUsed is called IF its corresponding IL_Layer is active.
private bool _enableOnStart = true;If
true, _layeredAction will be enabled when the object is loaded.
private bool _enableActionMapOnStart = true;If
true, _layeredAction's InputActionMap🔗 will be enabled when the object is loaded.
private bool _enableInputActionOnStart = true;If
true, _layeredAction._action (InputAction🔗) will be enabled when the object is loaded.
private bool _disableOnDestroy = true;If
true, _layeredAction will be disabled when the object destroyed.
private bool _disableActionMapOnDestroy = false;If
true, _layeredAction._action (InputAction🔗) will be disabled when the object is destroyed.
private bool _disableInputActionOnDestroy = false;If
true, _layeredAction._action (InputAction🔗) will be disabled when the object is destroyed.
private bool _activateLayerOnStart = true;If
true, _layeredAction._layer (InputLayer) will be enabled when the object is loaded.
private bool _deactivateLayerOnDestroy = true;If
true, _layeredAction._layer (InputLayer) will be disabled when the object is destroyed.
public void Enable ()Calls EnableWithParameters() with default values of
enableActionMap = trueandenableInputAction = true.
public void EnableWithParameters (bool enableActionMap, bool enableInputAction)Enables this script's and registers the appropriate event based on .
Parameters:
- enableActionMap: If
true, the InputActionMap🔗 this action belongs to will be enabled.
The map will remain enabled as long as LayeredActions that belong to it are enabled.- enableInputAction: If
true, the action will be "manually" enabled.
public void Disable ()Calls EnableWithParameters() with default values of
disableActionMap = falseanddisableInputAction = false.
public void DisableWithParameters (bool disableActionMap, bool disableInputAction)Disables this script's and unregisters the appropriate event based on .
Parameters:
- disableActionMap: If
true, the InputActionMap🔗 this action belongs to will be disabled.
The map will remain enabled as long as LayeredActions that belong to it are enabled.- disableInputAction: If
true, the action will be "manually" disabled.
public void DisableActionMap ()Disables the InputActionMap🔗 this action belongs to.
public void ActivateLayer ()Activates the IL_Layer that _layeredAction._action belongs to.
public void DeactivateLayer ()Deactivates the IL_Layer that _layeredAction._action belongs to.
private void OnStartedEvent (CallbackContext context)Triggered when _layeredAction is triggered IF _eventTypeUsed has a value of ActionEventType.
started.
private void OnPerformedEvent (CallbackContext context)Triggered when _layeredAction is triggered IF _eventTypeUsed has a value of ActionEventType.
performed.
private void OnCanceledEvent (CallbackContext context)Triggered when _layeredAction is triggered IF _eventTypeUsed has a value of ActionEventType.
canceled.
public enum ActionEventType
{
started,
performed,
canceled
}Used to select the type of LayeredAction delegates this script should call the _onEventTriggered UnityEvent for in the inspector.
👉🏻 Download InputLayers on the Unity Asset Store!