Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity and Playmaker 10 - Creating a Level Manager in Your Game

Nov 8, 2020
About this tutorial

Hi I'm Jerry from Bliz Studio LLC. In this intro to game design tutorial I'll be covering installing Playmaker Visual Scripting tool and iTween and a brief introduction to both. (subsequent videos will cover both more in-depth). How to Make a Video Game With Unity3D and Playmaker Series: Part 1: I

Written Guide

Episode 10 of the Unity and Playmaker series introduces a level manager for the space shooter: kill five ships, get a level-complete screen, hit continue, and the next level demands six. One FSM, two global ints, and a simple UI — plus a couple of instructive bugs along the way.

Step 1 — Organize the hierarchy

Before adding more systems, clean house: empty GameObjects named with dashes (------ UI ------, ------ Game Managers ------) act as section labels in the hierarchy. Scattering FSMs across scene objects works, but dedicated manager objects keep game-wide logic findable. Create an empty named Level Manager under the managers label.

Step 2 — The kill count global

The game already tracks kills in a global score int. Add a second global int named kill count, starting at 5 — the target for level one. The design: when score reaches kill count, the level is complete; each completion bumps kill count by one, so levels get progressively longer.

Step 3 — Listen and compare

The Level Manager FSM's listener state uses an Int Compare between score and kill count, firing a level complete event on both Equal and Greater Than — the greater-than catches two ships dying in the same instant. Two bugs surfaced in testing, both worth remembering. The compare triggered instantly at startup because Every Frame was unchecked: a one-shot compare runs once and never again, so check Every Frame on any continuous watch. And the variable order was reversed at first — make sure it reads score compared against kill count, not the other way around.

Step 4 — The level-complete state

Build a separate canvas named UI - Level Complete with centered TextMesh Pro text ("Level Complete") spanning the camera width, plus a Continue button — and disable the canvas in the inspector, since the FSM turns it on. The level complete state runs three Activate Game Object actions: spawner off, rocket off, level-complete UI on. A FINISHED transition leads to set new count, which does an Int Add of 1 to kill count and a Set Int Value returning score to 0, each once (not every frame). With no further transition, the FSM then parks in a wait for input state.

Step 5 — Continue via a global transition

Create a next level event and promote it to a global transition (right-click, Add Global Transition) on a new next level state. The wait state watches the Continue button with UI Button On Click Event and sends that global event. The next level state mirrors the shutdown in reverse — spawner on, rocket on, level-complete UI off — then loops back to the listener. Because score is already zeroed and kill count is one higher, the loop simply runs again at the new difficulty: 5 kills, then 6, then 7, indefinitely. The next episode builds on this with player health and a game-over flow.

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 →