Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity 3D Playmaker Creating Helix Jump - Level Generation

Feb 11, 2022
About this tutorial

In this mini Unity 3D Playmaker tutorial series, we will be taking a look at creating Helix Jump. In this fifth tutorial of the series, I will show the steps to setting up level generation. This one has a lot of steps but can be used in so many ways! (to Join my discord server add a comment and I

Written Guide

This longer Helix Jump tutorial covers procedural level generation — a technique useful well beyond this one game. It stacks randomly chosen, randomly rotated platform layers down a tower, capped by a fixed start layer and a level-complete layer, all driven by Playmaker arrays and a loop.

Prepare the layers and manager

Set up ahead of time: a start UI (panel plus button), ten prefab platform layers built from a shared cylinder base (each with different holes, enemies, and walls), and a level-complete prefab. The ball and ball manager start disabled. Add an empty Level Manager with an FSM whose first state listens via the start button's UI On Click Event, firing a generate event into the first generation state.

Build the arrays

Create two array variables. The first, layers, is a Game Object array of size 10 holding the platform prefabs. The second, rotation, is a Float array of size 12 holding the values 0, 30, 60 … 330 — since each pie slice of a platform is 30 degrees, 360 divided by 30 gives 12 valid rotations. Arrays are just containers (lists of objects, numbers, or strings) that the generator draws from.

Place a fixed first layer

The top layer must not be randomly rotated, so the player always has a safe green spot to bounce on. In the First Layer state use Array Get Random on layers, store the result in selected layer, then Create Object it under a Platforms parent at a Layer Spawn point (both at 0,0,0). This guarantees a fair starting platform before any randomization begins.

Generate randomized layers below

In the next state, use Float Subtract on a spawn position variable (minus 2, since each layer is two units tall) and Set Position on Layer Spawn so the spawn point steps down. Then Array Get Random on layers (store as selected layer), Create Object it (store the spawned object back to selected layer), Array Get Random on rotation into selected rotation, and Set Rotation on the spawned layer's Y angle to that value — each new layer drops two units lower and spins to a random 30-degree increment.

Loop, then cap and start the game

Add a Loop action (e.g. 10 iterations) that sends generate back to the randomized-layer state, building the tower's middle. When the loop finishes, transition to an End Layer state that subtracts another 2 units and Creates the level-complete prefab as the bottom. Finally, use Activate Game Object to turn the start UI off and switch the ball and ball manager on. Pressing play builds a full tower of random, rotated layers ready to play.

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 →