🎮 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
MinigameDataRight-click in the Project Window
Select
Create > PetCareGame > Minigame DataFill 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
GameInstanceOpen your GameInstance prefab or object and locate the minigamesData array:
public MinigameData[] minigamesData;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:
petContaineris 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
EndGamePopupIn the scene, add the prefab EndGamePopupand 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
ℹ️
gameIdshould 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