💎 Minigame “Gem Hunter”
Editing the “Gem Hunter” Minigame
Last updated
Editing the “Gem Hunter” Minigame
Last updated
Legal Notice: The Gem Hunter minigame is a customized integration of the official Unity sample project 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
To fully understand and modify the minigame, it is strongly recommended that you read the official documentation included in the project at:
This documentation explains in depth the project structure, gameplay loop, visual effects, level building process, and customization options.
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
.
To add a new level that works within this custom wrapper:
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.
Add a new StageDefinitionGemHunter
entry in MinigameGemHunter
:
Each stage entry is a StagesGemHunter
struct containing an index
and stageDefinition
.
Ensure the new scene is included in the Build Settings (File > Build Settings
) so it can be loaded at runtime.
The first scene should include:
The MinigameGemHunter
GameObject (it will persist via DontDestroyOnLoad
)
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:
And it will be matched in code using the method:
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.
Each level defines rewards for win and loss. After a match ends, the wrapper script calls:
The reward type (coins, stars, etc.) is configurable per level. The currency string ("GO"
or other) is handled by PlayerSave.AddCoin()
.
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.
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.