Unity 3D and Playmaker - Adding a Goal and updating a Score when Jellies reach the Goal.
In this tutorial, I add a Goal where the Jelly Sheep are to be herded. Then we will also add a Score UI and then update the Score each time a Jelly makes it into the Goal. Also check out How to Make a Bounce Game Series https://bit.ly/39HIYBU. ► Download Playmaker at https://bit.ly/3dV8JzC ► Downl
This guide adds a goal and a score to a sheep-herding game: the player moves a goal zone, sheep that enter it are destroyed and counted, and a TextMeshPro UI shows the running total. The work spans the jelly sheep prefab, a goal trigger, and a central game manager that owns the score.
Create the goal trigger
Add a 3D cube sized a little under the board tiles (around 0.4 on X and Z, flattened on Y) and name it Goal. Enable Is Trigger on its Box Collider so it detects sheep without physically blocking them, and set its tag to the built-in Finish tag — that tag is what the sheep will check against. No special effects are needed for the goal to function.
Give the sheep a collider and detection FSM
Open the jelly sheep prefab and add a jelly score FSM with a Goal Reached state sitting idle. Add a Rigidbody with Use Gravity off, remove the stray collider on the cylinder, and add a right-sized Box Collider (around 0.3 on X/Z, small on Y) to the main body. In the FSM use a Trigger Event on On Trigger Enter colliding with the Finish tag, firing an add to score event into a new Add To Score state.
Hold the score on a game manager
Create an empty Game Manager with a game score FSM, and add an int variable named score starting at zero — a whole number is all a count needs. Centralizing the score here keeps it independent of any individual sheep, which come and go as they're herded in.
Broadcast the score increment
Back in the sheep's Add To Score state, use Send Event By Name with Broadcast All sending add to score, rather than hunting down the manager directly. On the game manager, add a global event add to score and a global transition into an Add To Score state containing an Int Add of 1 on the score variable (run once, not every frame). Then finish the sheep's FSM into a Destroy Self state so the counted sheep leaves the board. If sheep launch into the air on test, it's the goal collider pushing them — make sure Is Trigger is on.
Display the running total
Add a UI > TextMeshPro under an empty UIs object. Set the canvas to Screen Space Overlay with Scale With Screen Size, a mobile match size (640x1136) and Expand, then place a bold, centered XXX placeholder near the top at around 60pt. In the game score FSM, convert the int with Int To String into a score text variable (every frame), then Set Property on the text component's string with score text. Finish back into the score state after each Int Add so the display refreshes — the total now climbs as each sheep reaches the goal.





