HookView Component
The HookView is the fundamental building block of a screen in HookUI. Every specific panel (Main Menu, Settings, Popup) must have this component.
Inspector Properties
Identity
- Category: Grouping for this view (e.g., "General", "HUD").
- ID: Unique identifier string. This is what the Graph uses to target this screen.
Behavior
- On Start Behavior: What happens when the scene loads?
DoNothing: Leaves the object as is.InstantHide: Disables canvas/raycasters immediately.InstantShow: Ensures it's visible.ShowAnimation: Plays the "Show" animation immediately.HideAnimation: Plays the "Hide" animation immediately.
State Management
HookUI optimizes performance by disabling components when hidden.
- Disable GameObject: Sets
SetActive(false)when hidden. - Disable Canvas: Disables the
Canvascomponent (optimizes render batching). - Disable GraphicRaycaster: Disables input processing.
- Handle CanvasGroup: Automatically toggles
alpha,interactable, andblocksRaycasts.
Events
Standard UnityEvents triggered during the lifecycle:
OnShowStartedOnShowFinishedOnHideStartedOnHideFinished
Public API (HookView)
If you inherit from HookView or reference it:
public class MyCustomScreen : HookView
{
protected override void Awake()
{
base.Awake(); // Important: Registers the view!
}
public void CustomLogic()
{
Show(); // Play animation and show
ImmediateHide(); // Force hide instantly
}
}