Skip to main content

HookUIManager API

The HookUIManager is the singleton that orchestrates the entire system.

Note: While HookUI is designed to work without code, you can drive it entirely from code if you wish.

Accessing the Instance​

HookUIManager.Instance

Inspector Fields​

FieldTypeDefaultNotes
_flowGraphHookUIFlowGraph—Private, assign in the Inspector. The graph asset that defines the navigation flow.
_initializeOnStartbooltrueIf checked, Initialize() runs automatically one frame after Start().
_backButtonIDstring"Back"See Back Button Shortcut below.
BlockInputOnTransitionbool (public)trueBlocks input via HookInputBlocker while a Show/Hide transition is in flight.

Back Button Shortcut​

Any HookButton (or OnButtonPressed call) whose ID matches _backButtonID does not follow a wire on the Graph — it calls GoBack() instead. This is a common point of confusion: if you have a button literally titled/ID'd "Back" and it isn't navigating where you wired it, check whether its ID collides with _backButtonID first.

Core Methods​

Initialize()​

Starts the flow, jumping to the definition of the Start Node in the Graph.

  • Usually called automatically if "Initialize On Start" is checked in the Inspector.

GoBack()​

Pops the navigation history stack and returns to the previous screen.

HookUIManager.Instance.GoBack();

OnButtonPressed(string buttonID)​

Simulates a button press. Useful if you have a physical button or keyboard input that should trigger a UI navigation event.

if (Input.GetKeyDown(KeyCode.Escape))
{
// Simulate pressing the "Back" button ID
HookUIManager.Instance.OnButtonPressed("Back");
}

NotifyTransitionStart() / NotifyTransitionFinish()​

Increment/decrement an internal counter used to drive BlockInputOnTransition. Called by the view transition machinery itself — you generally don't need to call these directly unless you're building a custom transition driver that bypasses the normal Show/Hide path.

RegisterView(IHookView view) / UnregisterView(IHookView view)​

Static. Adds/removes an IHookView from the internal ID lookup table. HookView/HookViewToolkit call these automatically in their own lifecycle — you only need them if you're implementing IHookView yourself outside those base classes.

GetView(string viewID)​

Static. Looks up a currently-registered IHookView by its ID, or null if nothing with that ID is registered.

var view = HookUIManager.GetView("Inventory");

Events​

  • OnNavigatedToNodeID: a public static event Action<string>. Subscribe to know whenever the current node changes.
// Static event — no HookUIManager.Instance and no null-check needed.
HookUIManager.OnNavigatedToNodeID += (nodeID) => {
Debug.Log($"We just arrived at: {nodeID}");
};

Portal API​

public static void Trigger(string triggerID)

A static method — no instance reference needed. Jumps to whatever Screen (or Quit) node the named Portal's wire points to, exactly like a normal button-driven transition (same Hide()/Show() calls, same back-stack push).

HookUIManager.Trigger("ToMainMenu");

This is the escape hatch for navigation that isn't triggered by a button on the current screen — timers, network callbacks, cutscene-end events, etc. See Portals for authoring Portal nodes in the Flow Editor, back-stack behavior, and worked examples — this page only covers the call signature.

Implementation Notes​

TransitionToScreen(ScreenNodeData, bool) exists internally but is a private method — it is not part of the public API and cannot be called from your own code. To force a jump programmatically, use Trigger(...) with a Portal, which is the supported entry point for the same behavior.