๐ฎ How to Add a New Minigame
The minigame system in PetCareGame is fully modular, allowing you to add new games with ease using MinigameData assets and custom Unity scenes.
๐งพ 1. Creating and Registering a Minigame
๐น Create a MinigameData
MinigameData
Right-click in the Project Window
Select
Create > PetCareGame > Minigame Data
Fill in the fields in the ScriptableObject:
sceneBuildName
The exact name of the Unity scene (must be in Build Settings)
sceneName
Translated name that appears in the minigame list
sceneIcon
The icon displayed in the minigame UI
๐ก Make sure the scene is added to File > Build Settings and the name matches exactly the
sceneBuildName
.
๐น Add to GameInstance
GameInstance
Open your GameInstance
prefab or object and locate the minigamesData
array:
Add the new MinigameData
to this list so that it will appear in the gameโs minigame menu.
๐ ๏ธ 2. Setting Up the Minigame Scene
๐น Instantiate the Pet Model
In your custom minigame controller script, instantiate the playerโs current pet using:
petContainer
is the transform where the pet should appear.You can call animations like:
These methods allow your minigame to feel fully integrated with the core pet system.
๐น Use the EndGamePopup
EndGamePopup
In the scene, add the prefab EndGamePopup
and disable prefab.
Add the EndGamePopup variable to your new minigame's controller and drag the prefab to the referencing field.
At the end of the minigame, just call something like this:
This will:
โ
Update the playerโs currency
โ
Show win/lose UI
โ
Track best score via PlayerSave
โ
Display results and return-to-home button
โน๏ธ
gameId
should be unique per minigame and is used to store high scores.
โ
Summary Checklist
Create MinigameData
asset
โ
Add to GameInstance.minigamesData
โ
Add the scene to Build Settings
โ
Instantiate pet using InstantiatePetModel()
โ
Include EndGamePopup
prefab
โ
This ensures your minigame is fully functional, personalized to the playerโs pet, and integrates seamlessly with the reward and tracking systems.
Last updated