Game.Input.UIBaseInputAction
Assembly: Assembly-CSharp
Namespace: Game.Input
Type: abstract class
Base: UnityEngine.ScriptableObject
Summary:
UIBaseInputAction is an abstract ScriptableObject that defines a UI-facing input action mapping used by the game's input/UX system. It provides common metadata (alias, display priority, device mask, option-group override) and exposes an abstract collection of action parts to be implemented by concrete assets. The class also provides helpers to build display name overrides for UI tooltips/labels and abstract methods to obtain runtime proxy state objects (IProxyAction) representing the action for a given input source. It contains nested types (a delegate, an interface, and enums) used by the input system to control display priority, processing type, and transform direction.
Fields
-
public string m_AliasName
This is the alias used for the action (human readable or logical name). It backs the read-only property aliasName. -
public Priority m_DisplayPriority = Priority.Disabled
Controls how prominently the action is displayed in UI (e.g., tooltip ordering). Default is Priority.Disabled. The property displayPriority returns this value as an int. -
public InputManager.DeviceType m_DisplayMask = InputManager.DeviceType.Gamepad
Device mask used to decide which device types should show this action in the UI (e.g., Gamepad, Keyboard). Used by GetDisplayName to filter which display entries are produced. -
public bool m_ShowInOptions
If true, the action is exposed in input/options UI (so users can remap it). -
public OptionGroupOverride m_OptionGroupOverride
Optional grouping/override data used by options UI to place this action into a specific option group or category.
Properties
-
public string aliasName { get; }
Returns m_AliasName. Read-only convenience property for the action alias. -
public int displayPriority { get; }
Returns the integer value of m_DisplayPriority. Can be used for sorting UI elements by priority. -
public bool showInOptions { get; }
Returns m_ShowInOptions. Indicates whether the action should be listed in options. -
public OptionGroupOverride optionGroupOverride { get; }
Returns m_OptionGroupOverride. Exposes grouping override for options UI. -
public abstract IReadOnlyList<UIInputActionPart> actionParts { get; }
Abstract property that concrete implementations must provide. actionParts typically contains one or more UIInputActionPart entries describing the specific controls/parts that make up this action (e.g., button press, axis, combined parts).
Constructors
public UIBaseInputAction()
As a ScriptableObject-derived type, instances are normally created via ScriptableObject creation APIs or the editor (CreateAssetMenu on concrete subclasses). There is no custom constructor logic in the class itself.
Methods
public DisplayNameOverride GetDisplayName(UIInputActionPart actionPart, string source)
If the actionPart's device mask (actionPart.m_Mask) intersects this action's m_DisplayMask, returns a DisplayNameOverride constructed with:- source (string)
- the proxy action from actionPart.GetProxyAction()
- this action's m_AliasName
- the integer display priority
-
actionPart.m_Transform
Otherwise returns null. Use this to build UI labels/tooltips for a given action part and input source. -
public abstract IProxyAction GetState(string source)
Abstract method. Concrete implementations must return an IProxyAction that represents the runtime state for the action for the supplied source (source typically identifies a control mapping or profile). -
public abstract IProxyAction GetState(string source, DisplayGetter displayNameGetter)
Abstract method variant that accepts a DisplayGetter delegate. Implementations should use the provided displayNameGetter to produce display name overrides for parts when building the proxy state, enabling custom display behavior per part. -
Nested types:
public delegate DisplayNameOverride DisplayGetter(string name, ProxyAction action, InputManager.DeviceType mask, Transform transform)
A function signature used to produce DisplayNameOverride objects for parts given a name, ProxyAction, device mask and transform. Passed into GetState to allow callers to control display naming.public interface IState
Exposes read-only list of ProxyAction via IReadOnlyListactions { get; } — used by state containers. public enum Priority
Priority levels for UI display ordering (Custom, Disabled, Tooltip, A, X, Y, B, DPad, Bumper, Trigger). Higher numeric values are generally shown earlier/more prominent.public enum ProcessAs
Hints how the input should be processed: AutoDetect, Button, Axis, Vector2.public enum Transform
(Flags)
Bitflags describing axis direction/press states (None, Down, Up, Left, Right, Negative, Positive, Vertical, Horizontal, Press). Used to indicate which transform of an axis/button the part represents.
Usage Example
// Example: minimal concrete ScriptableObject implementation
[CreateAssetMenu(menuName = "MyGame/UI Input Action")]
public class MyUIInputAction : UIBaseInputAction
{
[SerializeField]
private List<UIInputActionPart> m_Parts = new List<UIInputActionPart>();
public override IReadOnlyList<UIInputActionPart> actionParts => m_Parts;
public override IProxyAction GetState(string source)
{
// Build and return an IProxyAction for the given source.
// This is game-specific: typically you construct a proxy that
// contains ProxyAction entries for each part and uses aliasName/displayPriority.
return GetState(source, GetDisplayName);
}
public override IProxyAction GetState(string source, DisplayGetter displayNameGetter)
{
// Use displayNameGetter to create DisplayNameOverride entries per part,
// and assemble the proxy action. Implementation depends on game's proxy types.
throw new NotImplementedException();
}
}
// Using GetDisplayName to produce a label for a part in UI:
var display = myUIInputAction.GetDisplayName(somePart, "Default");
if (display != null)
{
// display contains the final label and metadata for UI rendering.
}
Additional notes: This class plugs into the game's input and options UI systems. Concrete asset instances typically live as ScriptableObject assets and are referenced by input managers or UI code to populate control lists, tooltips, and remapping dialogs.