Skip to main content

Interaction Mode Switcher

NAMESPACEMyDreamGameStudio.InteractAnything
MENU PATHInteraction System > Utilities > Interaction Mode Switcher
COMPATIBILITYUnity 6.0+
DOC VERSION

A central state machine that coordinates multiple interactors across your scene. It holds a list of available interactors (such as Raycast, Radius, and Cursor) and ensures exactly one is enabled at any given time, automatically disabling the rest.

Because it operates as a Singleton, external scripts (like UI prompts or input handlers) can read the active state globally without needing manually assigned references.


Editor Interface​

INTERACTION MODE SWITCHERSIMULATION STATE MACHINEINTERACTOR ROUTERCoordinates active interactor states across the scene, ensuring exactly one interactor is enabledat any given time.MANAGED INTERACTORS✦ Auto-Populate SceneInteractors0List is empty+-Starting Index0INPUT ROUTER INTEGRATION✦ Ping Input SourceInteraction Input SourceInteraction_Inputs (Interaction Input)Next Mode KeyTabPrev Mode KeyNoneInteract KeyE

Configuration​

Interactors
InteractorBase[]
The master list of interactors managed by this switcher. Only one of these will be enabled at a time. Use the 'Auto-Populate Scene' button to quickly gather all interactors in your current hierarchy.
Starting Index
intDef: 0
Which interactor in the array should be automatically enabled during Start().

Runtime API​

The Switcher exposes several public methods allowing you to cycle states programmatically. If you are using the included InteractionInput component, these methods are automatically mapped to your configured Next/Prev Mode keys.

// Switches to a specific interactor by its array index
InteractionModeSwitcher.Instance.SetActiveIndex(1);

// Switches to a specific interactor reference directly
InteractionModeSwitcher.Instance.SetActive(myCursorInteractor);

// Cycles sequentially through the list, wrapping around
InteractionModeSwitcher.Instance.Next();
InteractionModeSwitcher.Instance.Previous();