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
Configuration
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();