<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />
Navigation
</aside>
<aside> 💡 The template levels are generated by code. The Level Builder rebuilds the terrain, the props, the grass and the gameplay objects of a level scene from a layout class. A rebuild always gives the same result for the same layout.
</aside>
Level1…Level4.All scripts are in Assets/Project Files/Game/Editor/Level Generation.
The commands are in Tools → Slope Masters → Level Builder and work on the active scene. Open the level scene, make it the active scene (use Set Active Scene in the Hierarchy when several scenes are open) and run a command.
| Command | What it rebuilds |
|---|---|
| Rebuild All | Terrain, bridge and water, landmark prefabs, props, world objects, grass, and the positions of Start Point and Finish Point. |
| Rebuild Terrain | Heightmap and painted terrain layers. |
| Rebuild Props | Prop scatter under the Props root. |
| Rebuild Grass | Baked grass data. |
| Rebuild Bridge | The shared Pit Bridge prefab. |
| Rebuild World Objects | Coin packs, accelerator platforms, gems and the bridge and water placement, without rewriting the shared bridge prefab. |
| Rebuild Pit Walls | The Pit Walls group under Props. |
| Rebuild Boost Ring | Boost ring prefab of the flight level. |
| Level 1 → Rebuild Landmarks | Landmark prefabs (flags and finish line). |
The command works only for a scene that has a layout. The builder stops with the message Scene '<name>' has no SlopeLevelLayout for any other scene.
The scene needs these root objects: Terrain (with a Terrain component), Props, World Objects, Start Point and Finish Point.
| Field | Description |
|---|---|
| number, sceneName | Level number and the name of the level scene. The scene name links a scene to its layout. |
| finishZ | Z position of the finish line. |
| maxHeight | Height range of the terrain. |
| heightmapResolution, alphamapResolution | Terrain resolution. A longer level needs a finer heightmap. |
| seedOffset, meanderSeed, hillsSeed | Random seeds of the scatter, the road winding and the hills. |
| width | Terrain width. |
| flight | A FlightLayout. When set, the level is generated as a flight level. |
| pitStartZ | Position of the pit with the bridge. |
| centerWaypoints | The road centerline as (z, x) points. |
| elevationWaypoints | The height profile as (z, height) points. |
| branches | Side roads, forks and gem paths. |
| acceleratorZ | Z positions of accelerator platforms. |
| roadObjectZ | Z positions of road objects that roadside bushes keep clear of. |
| gemIdPrefix, coinIdPrefix | Id prefixes of the generated pickups, used for the save. |
The pit and bridge sizes are fixed because the shared bridge prefab is built for a 40 m pit and a 58 m deck.
Create the scene. Duplicate a level scene, for example Level 2, and rename it.
Add a layout. Add a static SlopeLevelLayout to SlopeLevelLayout.cs with the new sceneName, and add it to the All array.
public static readonly SlopeLevelLayout Level5 = new SlopeLevelLayout
{
number = 5,
sceneName = "Level 5",
seedOffset = 5,
meanderSeed = 21.1f,
hillsSeed = 33.3f,
gemIdPrefix = "gem_level5_",
coinIdPrefix = "coin_l5_",
// Copy pitStartZ, centerWaypoints, elevationWaypoints, branches,
// acceleratorZ and roadObjectZ from Level1 and adjust them
};
public static readonly SlopeLevelLayout[] All = { Level1, Level2, Level3, Level4, Level5 };
The id prefixes must be unique for every level, because the pickup ids are saved.
Open the scene. Make it the active scene.
Run the builder. Use Tools → Slope Masters → Level Builder → Rebuild Terrain, then Rebuild Props, Rebuild World Objects and Rebuild Grass.
Save the scene. Saving bakes the chunks and the start and finish references.
Register the level. Follow How to add a new Level.
Keep the waypoint lists ascending by Z. The centerline must stay constant across the bridge and the elevation must stay flat from the pit start to about 45 m after the pit.
The slope and friction values must match the vehicle. Use the Balance Tool to check that a level can be finished. See Progression & Economy.