Inventool Documentation
  • Inventool Documentation
  • đŸ•šī¸Quick Start
    • Installation
    • Start Creating
  • 💡General
    • Running the Demo
    • Menu Options
    • UI Updates
    • UI Customizations
      • uGUI
      • UI Toolkit
    • Custom Item Drops
  • 🎓Tutorials
    • Demo Walkthrough
  • âœī¸Editors
    • Inventool
      • Inventory
      • Equipment
      • Items
      • Currencies
      • Crafting
      • Dismantling
      • Enchanting
      • Stats
        • Stat IDs
        • Attributes
      • Settings
    • Item Type Manager
    • Localization Editor
    • Stats Editor
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
    • Storage
    • Loot
      • Loot Box
      • Item Pouch
      • Currency Pouch
    • Components
      • Initializer
      • UI
        • uGUI
          • Inventool Window
          • Split UI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
            • Selector UGUI
          • Action Menu UGUI
          • Hover Details UGUI
          • Confirm Prompt UGUI
          • Quantity Prompt UGUI
          • Character Viewer Element UGUI
        • UI Toolkit
          • Inventool Window
          • Split UI
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
          • Action Menu
          • Hover Details
          • Confirm Prompt
          • Quantity Prompt
        • Character Viewer
      • Overworld Merchant
      • Storage Keeper
      • Item Drop
      • Item Spawner
      • Input
        • Cross Input Support
        • Cross Input Support UGUI
          • Target Selectable
  • 📄Scripting API
    • Initialization
    • Inventory
    • Equipment
      • Equipment Slot
    • Items
      • Item
      • Item Type
      • Item Stack
      • Item Drop
      • Item Spawner
      • Loot Box
      • Item Pouch
    • Currencies
      • Currency Identity
      • Currency
        • Value
      • Currency Pouch
    • Crafting
      • Craft
      • Crafter
    • Enchanting
      • Enchantment
    • Stats
      • Stat Identity
      • Attribute
      • Stat
        • Stat Value
          • Value
        • Effectiveness
      • Stat Profile
    • Storing
      • Storage
      • Storage Keeper
    • Settings
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
      • Overworld Merchant
    • UI
      • uGUI
        • Inventool Window UGUI
        • Split UI
          • Draggable Window UGUI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
          • Selector UGUI
        • Action Menu UGUI
        • Hover Details UGUI
        • Confirm Prompt UGUI
        • Quantity Prompt UGUI
        • Draggable Element UGUI
          • Equipment Slot Element UGUI
          • Item Slot Element UGUI
          • Item Stack Element UGUI
        • Action Menu Option UGUI
        • Currency Element UGUI
        • Inventory Filter UGUI
        • Inventory Slot UGUI
        • Key Item Element UGUI
        • Shop Item Element UGUI
        • Storage Currency Element UGUI
        • Stat Element UGUI
      • UI Toolkit
        • Inventool Window
        • Split UI
          • Draggable Window
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
        • Action Menu
        • Hover Details
        • Confirm Prompt
        • Quantity Prompt
        • Item Elements
          • Item Stack Element
          • Equipment Slot Element
          • Item Slot Element
          • Shop Item Element
      • Action Menu Option
      • Character Viewer
    • Events
    • Sounds
    • Saving & Loading
      • Inventory & Equipment
      • Storage
    • Input
      • Cross Input Support
      • Cross Input Support UGUI
    • Localization
      • Localization Settings
      • Localizer
  • đŸ› ī¸Support
    • Getting Help
  • 📚Changelogs
    • Latest Releases
    • Future Plans
  • ⭐Rate Me?
Powered by GitBook
On this page
  • Fields & Properties
  • Active Instance
  • Registration
  • Top Window
  • Focusables
  • Find Focusables
  • Find Initial
  • Selection
  • Select
  • Deselect
  • Locking
  • Unlocking
  • Moving
  1. Scripting API
  2. Input

Cross Input Support

Scripting with the CrossInputSupport class.

The CrossInputSupport class provides keyboard and controller navigation support for Inventool's UI when set up properly with the PlayerInput and UIDocument components.

Fields & Properties

Name
Description
Type
Access

document

The UI document solely for the element selector.

UIDocument

public

input

The player input component.

PlayerInput

public

playerMap

The player input map name.

string

public

menuMap

The menu input map name.

string

public

selector

The targetter visual element.

VisualElement

public

top

The document currently over all others.

CrossInputSupportedWindow

public

focusables

A list of focusable visual elements of the top document.

List<VisualElement>

public

selectedFocusable

The currently targeted focusable.

VisualElement

public

initialFocusable

The initial focusable element.

VisualElement

public

windows

A list of all registered UI documents in the scene.

List<CrossInputSupportedWindow>

public

initialFocusablePosition

The placement of the initial focusable.

InitialFocusablePosition

public

scrollingSensitivity

The scrolling sensitivity used when locked on a scroller.

float

public

animationCoroutine

The coroutine that handles the selector's animation.

Coroutine

private

moveHeldCoroutine

A coroutine that handles move button holding.

Coroutine

private

lockedMoveAction

An action to execute when the selector is locked on a focusable.

Action

private

moveDirection

The current move direction.

Vector2

private

isLocked

If the selector is currently locked on the selected focusable.

bool

private

Active Instance

You can get the active CrossInputSupport instance with CrossInputSupport.Instance. Ensure there's an instance of it in your scene before using this field.

Registration

The CrossInputSupport class only works on registeredCrossInputSupportedWindow components. Use the Register method to register a CrossInputSupportedWindow.

CrossInputSupport.Instance.Register();

Use Unregister to have the opposite effect.

CrossInputSupport.Instance.Unregister();

Top Window

The window at the top of every other one will have navigation control. To update the top window, use the DetermineTop method.

CrossInputSupport.Instance.DetermineTop();

Focusables

Focusables are VisualElement's that can be focused by the CrossInputSupport seelctor.

Find Focusables

To find all focusables of the top document, use the FindFocusables method. This will update the focusables field.

CrossInputSupport.Instance.FindFocusables();

Find Initial

The initial focusable is the first one selected when navigating as decided by the initialFocusablePosition field. Use the FindInitial to get the initial focusable. this will update the initialFocusable field.

Selection

A focusable VisualElement is selected when navigating with any move button. The selected focusable will have the selector targeting it.

Select

To simulate a selection, use the Select method. If the selector is locked, this method will do nothing.

CrossInputSupport.Instance.Select(visualElement);

To select the initial focusable, use SelectInitial.

CrossInputSupport.Instance.SelectInitial();

Deselect

Use Deselect to deselect the current selection and hide the selector graphic.

CrossInputSupport.Instance.Deselect();

Alternatively, you can use AssessSelection, which will deselect the current selection if it's not enabled or focusable anymore.

CrossInputSupport.Instance.AssessSelection();

Locking

To lock on a focusable, when a focusable is selected, use the Lock method. When a focusable is locked on, navigation will be prevented.

CrossInputSupport.Instance.Lock();

Unlocking

The Unlock method will stop locking on to a focusable.

CrossInputSupport.Instance.Unlock();

Moving

Use the Move method to move the selector towards a direction.

CrossInputSupport.Instance.Move(Vector2.down);
PreviousInputNextCross Input Support UGUI

Last updated 2 months ago

📄