🗺️ UI Main Menu
UIMainMenu – Component Overview
The UIMainMenu component controls all logic related to the main menu interface, pet selection, scene switching, and HUD in the Virtual Pet Game Template. This page provides a summarized explanation of its key editable public variables and how to configure or expand them.
🎛️ Root Menus
uiNewPlayer: Shown when no nickname/pet is registered yet.uiGame: Main gameplay UI shown after account creation.
🐾 New‑Player Flow
startMenu/selectMenu: Panels for nickname input and pet selection.startGameBtn: Button to confirm nickname and go to pet selection.nicknameInput: Text field for the player’s nickname.petEntryPrefab: Prefab used to display each available pet.petEntryContainer: UI container to hold all pet entries.confirmBtn: Confirms nickname and pet selection to start the game.
🧾 Gameplay HUD
petNickname: Displays the pet’s nickname.level: Displays the player's current level.levelProgress: Fillable image for level EXP progress.fillTweenDuration: Duration of the EXP fill animation.
🐶 Pet Model
petModelContainer: Where the selected pet is instantiated.
📂 In‑Game Menus
Each menu object below can be assigned and then called via OpenMenu(string id):
uiFridgeuiFoodShopuiSettingsuiClosetuiClothesShopuiBeduiMinigames
To add new menus:
Create a new GameObject panel in the UI.
Add it as a public variable in this script.
Register it in the
menuMapdictionary insideAwake().Call it using
OpenMenu("your_id").
🏠 Scenario Configuration
nextSceneBtn/prevSceneBtn: Buttons to navigate between available scenes.sceneNameLabel: Displays the current scene name (localized).scenes: List of available scenario entries. Each contains:sceneId: Unique identifiersceneName: Translatable labelsceneBackgroundObj: Prefab for backgroundsceneOptions: Optional prefab with interactive props
sceneBgContainer: Where the background is instantiated.sceneOptionContainer: Where scene props/options are instantiated.
✅ To add a new scene:
Create a new
GameSceneentry in thesceneslist.Assign a unique
sceneId, background prefab, and optionally an options prefab.Add a
sceneNametranslation using the LanguageManager.
This component is essential for initializing gameplay, managing navigation, and controlling the overall user experience from the home screen.
Last updated