Menus and HUD¶
Main menu¶
MainScene's Canvas_UI has three root panels: MainMenu (MainMenuManager), Campaign
(CampaignMenuUIManager) and Settings (SettingsManager). MenuNavigationManager shows one at a time, with
history and transitions. Screens are found by component type, not by name, so you can rename and redesign them.
The game name is in MainMenu/Title ("Dungeon Crawler Template") and MainMenu/Subtitle ("Turn-Based FPS RPG"). They
are not localized: edit them in the Inspector. Menu and pause backgrounds use an AspectRatioFitter set to
Envelope Parent, so they cover any aspect ratio without distortion.
Add a menu screen¶
- Create a root panel with your own component (one type per screen).
- To refresh on open, implement
IMenuScreen.OnMenuShown()on the same object. - Add the panel to
MenuNavigationManager.menuItems. - Navigate with
MenuNavigationManager.Instance.NavigateToMenu<MyScreen>()andGoBack().
Navigation requests during a transition are dropped.
Add a settings option¶
- Create the save key and field (see Save, settings and difficulty).
- Add a
HorizontalSelector(Prefabs/Menu/SettingsOption) wired toSettingsManager. - Make your system listen to
SaveManager.ProfileChanged. - Create the texts in the
Settingstable.
Warning
SettingsManager removes all listeners from the selectors and sliders it configures. Don't wire persistent
events on them in the Inspector.
Loading screen¶
Prefabs/Menu/LoadingScreen.prefab shows a random background and a tip from the Hints table. Change scenes with
LoadingScreen.Load("MyLevel"), LoadingScreen.Reload() or LoadingScreen.LoadMainMenu(). The scene must be in
Build Settings.
In-level UI¶
Everything shown during a level is in Prefabs/Core/UILevel.prefab, controlled by GameManagerUI: the HUD,
minimap, interaction prompt, boss bar, damage feedback, pause screen, death screen, end screen, shop, item
inventory (Y), dialogue and toasts. References are serialized (nothing is found by name), so you can redesign the
prefab as long as the Inspector references stay wired.
Note
The standalone Managers/GameManagerUI.prefab has empty references. Always use UILevel.prefab.
Photo mode
F2 hides or shows the whole CanvasUI for screenshots. It is not saved. Change the key in Photo Mode Key
on GameManagerUI; set it to None to disable photo mode.
Show messages from code:
using AiasTech.Core.UI;
GameManagerUI.Instance?.ShowPickupToast("Armor +25", armorIcon);
GameManagerUI.Instance?.ShowPopupScreen("Secret found");
Add a modal panel¶
Implement IGameplayModal (Close()) and call GameplayModalGate.SetVisible(this, true/false) on open and close
(including OnDisable). Esc then closes your panel instead of pausing, and the player can't act while it's open.
Parent it to GameManagerUI.Instance.PanelsCanvas.
Pause¶
Toggle with GameStateManager.Instance.TogglePause(); listen to GameStateEvents.PauseChanged and
GameStateEvents.DeathEntered.
Note
While paused, Time.timeScale is close to zero, not exactly zero. Use Time.unscaledDeltaTime for UI
animations that must run while paused.
For internals, see Assets/DungeonCrawler/Scripts/Menu/ARCHITECTURE.md and
Assets/DungeonCrawler/Scripts/Core/ARCHITECTURE.md.