Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity + Playmaker - EASY Pinball Game - Bonus Bumpers and Score

Mar 14, 2022
About this tutorial

In this mini Unity + Playmaker EASY Pinball Game tutorial series, I am going to show setting up the bonus bumpers with colliders and physics materials as well as adding a creating a scoreboard and being able to add score. ► Download the board graphics here: https://bit.ly/3BWk0v2 (to Join my disco

Written Guide

This entry in the pinball series builds the bonus bumpers — the 10, 20, and 30-point targets that only score while lit — plus a global scoring system with a proper digital readout. The design splits each bumper's logic into two cooperating FSMs: a timer that decides when the bonus is live, and a bonus FSM that handles looks, physics, and points.

Step 1 — Unlit look and two physics materials

Start by graying the bumper's white circle sprites to CFCFCF so the unlit state reads at a glance. Add a Circle Collider 2D, then create two Physics Material 2D assets: bonus bumper one (friction 4, bounciness 0.3) for the dormant state, and bonus bumper two with friction lowered and bounciness raised to 1.2 — a lit bumper shouldn't just score more, it should kick harder.

Step 2 — The timer FSM

The first FSM, named Timer, is just two states ping-ponging on Random Wait actions — off for a few seconds, on for a few — with each state's exit using Send Event By Name to fire bonus off or bonus on at the second FSM. Random waits keep the bumpers from blinking in lockstep. Initial values of 3-4 seconds off and 1-2 on proved too frantic in testing; 5-6 off and 3-4 on play better.

Step 3 — The bonus FSM

The second FSM, Bonus, has bonus off and bonus on states, each behind a global transition so the timer can target them. Bonus off uses Set Property on the collider to assign the tame physics material and Set Sprite Color to gray out both circle sprites; bonus on swaps in the bouncy material and sets the sprites white. Scoring lives only in the on state: a Collision 2D Event watching for the pinball ball tag fires add to score, which does an Int Add of 10 to a new global int named pinball score, then returns to bonus on. Hits while unlit simply never reach scoring logic — the timing gate falls out of the state machine for free.

Step 4 — Clone to the other bumpers

Right-click each FSM component and Copy Component, then Paste Component As New on the 20 and 30-point bumpers (plus their circle colliders). Because every bumper owns its own timer, the rarity can scale with the value: the 30-pointer waits 10-12 seconds between lights, the 20-pointer 7-8. Drag all three into the pinball prefabs folder so future boards get fully wired bumpers for free.

Step 5 — The score display

In the game canvas, two UI images form the score housing (a black inner panel and a lighter purple outer frame), anchored to top-center so they survive rescaling. For the readout, grab a digital-style TTF font (DS-Digital from dafont in the video), then run it through Window > TextMesh Pro > Font Asset Creator — Generate Font Atlas converts the TTF into a TMP-usable asset. A Score Manager FSM updates the display continuously with two every-frame actions: Convert Int To String turns the global pinball score into a pinball score text string, and Set Property pushes that string into the TextMesh Pro text field. Fire a ball, hit a lit bumper, and the digits tick up — scoring, feedback, and reusable parts all done.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →