💎 Minigame “Gem Hunter”
Editing the “Gem Hunter” Minigame
Legal Notice: The Gem Hunter minigame is a customized integration of the official Unity sample project Gem Hunter Match available on the Unity Asset Store. It is used here under the terms of the Unity Companion License, available at: https://unity3d.com/legal/licenses/unity_companion_license
📖 Official Documentation
To fully understand and modify the minigame, it is strongly recommended that you read the official documentation included in the project at:
PetCare/Res/GemHunterMatch/Documentation
This documentation explains in depth the project structure, gameplay loop, visual effects, level building process, and customization options.
🧭 Custom Flow in This Project
In the PetCareGame
, the minigame is managed through the custom script MinigameGemHunter.cs
, which is responsible for:
Instantiating the player's pet character.
Detecting when a stage is completed or failed.
Controlling the transition between levels.
Handling custom reward distribution via the
EndGamePopup
.
🗺️ How to Add a New Gem Hunter Stage
To add a new level that works within this custom wrapper:
1. Create Your Level Scene
Follow the official Unity instructions to design your board:
Use the Tile Palette with Logic, Tilemap, and Tilemap_Frame layers.
Configure matchable tiles, blockers, spawn arrows, and background.
Add LevelData GameObject in your scene to define goals, moves, music, and camera borders.
2. Configure Stage Info in ScriptableObject
Add a new StageDefinitionGemHunter
entry in MinigameGemHunter
:
public StagesGemHunter[] gameStages;
Each stage entry is a StagesGemHunter
struct containing an index
and stageDefinition
.
3. Add the Scene to Build Settings
Ensure the new scene is included in the Build Settings (File > Build Settings
) so it can be loaded at runtime.
4. Instantiate the MinigameGemHunter Object
The first scene should include:
The
MinigameGemHunter
GameObject (it will persist viaDontDestroyOnLoad
)The characterContainer assigned properly
A reference to the EndGamePopup prefab and UI container
Properly configured
StageDefinitionGemHunter
for this scene
A typical scene name would follow the pattern:
Minigame_Gem_Scene_1
Minigame_Gem_Scene_2
And it will be matched in code using the method:
private int GetStageIndexFromScene(string sceneName);
🧠 Summary of Core Objects in a Scene
Grid / Logic
Level layout and tile logic (gem placement, spawn points).
Tilemap & Frame
Visual decoration.
Lights & VFX
URP 2D lights for dynamic lighting on puzzle pieces.
LevelData
Holds goals, moves, background track, and camera settings.
🎁 Rewards and Currency
Each level defines rewards for win and loss. After a match ends, the wrapper script calls:
ShowEndGamePopup(score, currencyId, currencyAmount, isWin);
The reward type (coins, stars, etc.) is configurable per level. The currency string ("GO"
or other) is handled by PlayerSave.AddCoin()
.
🧪 Testing and Iteration
You can test a level directly in the Unity Editor. The GameManager
will be instantiated automatically at runtime if missing. To integrate a new level into gameplay flow:
Add it to the
gameStages
list.Create a
MinigameGemHunter
prefab or GameObject.Link UI elements and character container.
Add the scene to build list.
💡 Customization Tips
To reskin the minigame, simply replace sprites and tile assets used in your level scene.
You may disable decorative GameObjects like
BG
,VFX_Bubbles
for a cleaner look.
Last updated