Remake Roller Splat with Unity 3D and Playmaker - The BIGGIE - Setting up a Level Manager and Levels
In this Unity and Playmaker tutorial series I'll recreate Roller Splat. PART 5 - In this Supersized tutorial - I'll be setting up a Level Manager and an Array of levels that we will pull from to add on screen. Absolutely NOCODE. Also check out How to Make a Bounce Game Series https://bit.ly/39HIYB
This is the big one in the Roller Splat remake: a full level-management system. Levels live in an array as prefabs, a Level Manager pulls them into the scene, and a clean handoff between the level and the manager handles completion, cleanup, and the next level. Here's the architecture step by step.
Step 1 — Stop hand-counting tiles
First, a viewer tip (thanks, Gru Gadgets) that makes levels self-configuring: instead of hardcoding the number of floor tiles with Set Int Value, use Get Child Count on the Floors container and store the result in the level tile count global. Each level now counts its own tiles at setup, so building new layouts never requires updating a number by hand.
Step 2 — Create the Level Manager and spawn point
Make two empties: Level Manager (under Managers) and Levels, which holds a child called Level Spawn Point positioned exactly where level one sits — every future level is built from that same origin. The manager FSM's create level state uses Create Object with the level prefab, Levels as the parent, and the spawn point as the location. Turn off the original scene copy of level one; from now on levels only exist as prefab instances.
Step 3 — Let levels talk to the manager
The level-complete UI activation moves out of the level and into the manager, behind a global transition named level complete. The catch: a prefab can't reference scene objects directly, so a spawned level has no link to the manager. The fix is a tag-and-find handshake — tag the Level Manager object, and in the level's setup state run Find Game Object by that tag, storing the result in a variable. On completion, the level uses Send Event By Name targeting that stored object, firing level complete on the manager. (If the target object carried multiple FSMs you'd also specify the FSM name; with one FSM it's optional.)
Step 4 — Build the array of levels
After building two more layouts from level one's guts, create an array variable named levels (type Game Object, size 3) on the manager and drop in all three prefabs. Above Create Object, add Array Get Random with No Repeat checked, storing the pick in a chosen level variable that feeds Create Object. No Repeat plays every level once before recycling; Array Get Next is the alternative if you want strict sequential order.
Step 5 — Next-level button and cleanup
Add a bold NEXT LEVEL button to the complete UI. The manager's level complete state deactivates the ball, then watches the button with UI Button On Click Event; clicking fires a next level transition. Inside the level prefab, a destroy self state (Destroy Self action) runs right after the send-event — copy it into every level prefab so old levels remove themselves. The manager's create level state also deactivates the UI before spawning.
Step 6 — Reset the ball
With the walls destroyed, the still-rolling ball escapes — so a reset ball state runs between the button click and the next spawn. It reactivates the ball, zeroes its Translate (empty vector, per-frame unchecked) to kill the motion, and Set Position returns it to its start at (-2, 0, -3). From there it's back to create level, and the loop runs forever — add as many levels as you like, or sort them into easy, medium, and hard pools later.





