Repository navigation
InputLayer
Namespace: Lowry.UI.InputLayers
public struct InputLayer : IComparable, IComparable<InputLayer>, IEquatable<InputLayer>Represents an IL_Layer with an advanced custom inspector.
This structure is mainly for internal use, and it is unlikely that you will need to work with it directly.
Its main goal is to expose a custom property drawer for the Unity Inspector that can point to any IL_Layer you have configured within the InputLayers editor window.
This is a core component of the LayeredAction system.
public string name;The name of the IL_Layer this is meant to represent.
Since layer names must be unique, this serves as the actual reference to the underlying IL_Layer.
public readonly IL_Layer _layer { get {...} }Resolves name through GetLayerByName on each access. The lookup uses the manager's cache, not a reference stored in this struct. Returns
nullfor a null, empty, or unknown name, or when the singleton is unavailable.
public event Action onActivated { add {...} remove {...} }Forwards subscriptions to _layer.onActivated. Adding or removing a handler requires a resolvable layer name.
public event Action onDeactivated { add {...} remove {...} }Forwards subscriptions to _layer.onDeactivated. Adding or removing a handler requires a resolvable layer name.
public readonly int? _priority { get {...} }The cached zero-based index of this layer's IL_PriorityLayer within IL_ScriptableRefs.r_priorities.
Isnullif the name cannot be resolved or the layer has no cached priority entry.
public readonly bool _isActive { get {...} }
truewhen this layer is currently the unique active layer.Security: Will return
falseon the same frame as the layer was activated on.
Otherwise, an input could be used to activate a layer, and then be triggered on that same layer immediately.
public readonly bool _isActiveUnsafe { get {...} }
truewhen this layer is currently the unique active layer, even when called on the same frame the layer was activated on.
public readonly bool _isEnabled { get {...} }
truewhen the resolved layer has a cached priority and is either the selected layer or present in that priority's activation stack. This check does not exclude the activation frame.
IMPORTANT: It may not be active. Returnsfalsewhen the layer cannot be resolved or has no cached priority.
public readonly bool? Activate () {...}Tries to activate the _layer.
Returns:
truewhen the layer has been activated (or was already active).falsewhen the layer has not been activated (it will still be added to the relevant stack).nullwhen the name cannot be resolved or the resolved layer has no cached priority.
public readonly void Deactivate () {...}Removes the _layer from its activation stack and selects the top layer of the highest non-empty priority. Removing the selected layer notifies it of deactivation and any replacement of activation. If no layers remain, the selected layer and current priority become
null. Removing a waiting layer does not invoke activation or deactivation events.
public InputLayer (string name_) {...}Stores the layer name without validating or registering it. Use a non-empty name already present in the layer lookup cache to reference a configured layer.
public InputLayer (IL_Layer layer) {...}Copies
layer.namefrom a non-null IL_Layer; it does not retain the object reference or register the layer.
Equality, hashing, and comparisons use stored names with ordinal semantics; they do not resolve layers or require the singleton. Unknown names can be compared and hashed safely. Default-constructed InputLayer values have null names and compare equal to each other.
All CompareTo overloads use ordinal name ordering. The object overload accepts InputLayer and IL_Layer values, returns a positive value for null, and rejects unsupported types with ArgumentException. Comparing to a null IL_Layer also returns a positive value.
Cross-type == and != operators with IL_Layer compare the stored name to the non-null layer's name. A null IL_Layer is not equal to any InputLayer, including a default value. Equals(object) accepts only another InputLayer, preserving symmetric object equality; it returns false for null or an IL_Layer object.
A default-constructed InputLayer has a null name and is not a configured layer reference. Changing name after subscribing to events does not move the subscription to the new layer.
👉🏻 Download InputLayers on the Unity Asset Store!