Level Menu and Generation

Or, ScriptableObjects to the Rescue

There is now a new problem. If the game is changing, how do we handle progressing in the game? If the progression is levels, how do we go about creating those levels?

I struggled with this for quite a while. In all the places I looked online it seemed like the only two level-creation strategies were with procedural generation or by making each scene it's own level. Personally, this game doesn't seem like a good type for procedural and it would be too large if each level was a scene of its own. It took a while of reading, but there was a suggestion on some hidden message board about keeping prefabs and adding/removing them when the game plays. !

My plan became: to create a ScriptableObject in Unity that would serve as a "database" and store metadata about a level. It would store:

  • The level name, for getting/updating the level
  • If the level was locked because it hasn't been reached yet, or if it was completed
  • The stars and score awarded for the level
  • Details on the numbers, colors, and speeds of enemies
  • Details on the position, rotation, and color of traps

It was actually on the flight back home from Vegas that the system started working as intended. Now, as levels get added to the "database", they'll automatically show up in the level select and can be played!

Not gonna lie it felt really good to get that working