The Input Button Trigger allows triggering something by pressing a gamepad button.

It assumes that there is a (Better) Button or (Better) Toggle on the same game object that would be triggered by the input. If not, you need to "Use Custom Event" (see below).


Inspector Properties


Condition

Defines a condition that needs to be fulfilled to detect the button press. If it is not fulfilled, also the Visualization will be hidden.


  • Part Of Current Navigation Group
    The Selectable on the same Game Object is managed by the currently focused Navigation Group.
    If there is no Selectable on the same game object, this will only be fulfilled, if there is a Navigation Group on the same game object that is currently focused.
  • Part Of Active Navigation Controller
    Behaves similar to the first option, but the group doesn't need to be focused. It is enough if the group is managed by any Navigation Controller (Navigation Group Switch Controller or Tab Switch Controller) that is currently enabled.
  • No Navigation Group Active
    There is no Navigation Group currently focused (meaning that the root selectables of Better Navigation are active).
  • Part Of Specific Navigation Group
    Behaves similar to the first option, but the group doesn't need to be focused. Instead, it must be the group that can be assigned to the "Containing Navigation Group" field that appears when this option is selected.
  • Specific Navigation Controller Active
    Checks whether a specific navigation controller (Navigation Group Switch Controller or Tab Switch Controller) is currently active and enabled. The navigation controller must be assigned to the "Related Navigation Controller" field that appears when this option is selected.
  • Specific Navigation Group Focused
    Checks whether a specific Navigation Group is currently focused. The Navigation Group must assigned to the "Related Navigation Group" field that appears when this option is selected.
  • Named Navigation Controller Active
    This works similar to "Specific Navigation Controller Active" (see above), but instead of specifying the Navigation Controller directly, the name of its game object is specified in the appearing "GameObject Name of Navigation Controller" field. This is rather helpful when working with dynamicly loaded UI where it is not possible to reference it outside play mode. Note that the name should be unique, otherwise the first found Navigation Controller with the given name will be used.
  • Named Navigation Group Focused
    This works similar to "Specific Navigation Group Focused" (see above), but instead of specifying the Navigation Group directly, the name of its game object is specified in the appearing "GameObject Name of Navigation Group" field. This is rather helpful when working with dynamicly loaded UI where it is not possible to reference it outside play mode. Note that the name should be unique, otherwise the first found Navigation Group with the given name will be used.

  • Currently Selected
    Checks whether a specific Selectable is currently selected. The selectable must be assigned to the "Related Selectable" field that appears when this option is selected.
  • Toggle Currently On
    Checks whether a specific (Better) Toggle's "isOn" state is currently "true". The toggle must be assigned to the "Related Toggle" field that appears when this option is selected.
  • Toggle Currently Off
    Checks whether a specific (Better) Toggle's "isOn" state is currently "false". The toggle must be assigned to the "Related Toggle" field that appears when this option is selected.
  • Any Child Selected
    Checks whether any Selectable is selected which is a child (or sub-child) of a specific Rect Transform "Parent Object". This "Parent Object" field appears when this option is selected. It must be assigned.

  • Always Trigger
    Does not check anything and considers the condition fulfilled, but only triggers if the Input Button Trigger is active and enabled (in other words: it must be in the static "ActiveHandlers" list - see below).
  • Never Trigger
    Does not check anything and considers the condition as not fulfilled.


Button Action Type & Visualization

The Input Action Binding which triggers the logic with optional Input Action Visualization to show the button to the player.


Use Custom Event

If checked, a "Custom Event" field appears where you can specify what method is called when the button is pressed (and the condition is fulfilled).

If not checked:

  • If there is a Toggle or Better Toggle on the same game object: the "isOn" state will invert (true becomes false, or false becomes true)
  • If there is a Button or Better Button on the same game object: the "onClick" method of the button is invoked.
  • In any other case a warning will be logged.



Code Access

Static


ActiveHandlers

This is the same property, that is also described in Navigation Group Switch Controller (because they share a base class)



Non-Static


Condition

Gets the value (see Inspector Properties).


ButtonActionType

Gets or sets the value and updates the visualization (see Inspector Properties).


ButtonActionTypeWithoutTiming

Gets the "ButtonActionType" but without the timing information flags ("Began", "Repeated" and "Ended" are removed from the returned value).


UseCustomAction

Gets or sets the value  (see Inspector Properties)


TriggerEvent

The callback which is used as trigger if "UseCustomAction" is set to true.