Multiple scenes or one scene for all game levels?


I am planning a game that will include a lot of levels that can be quite big and some quite small but I started to think about something. Would it be best suited for me to use like 30 scenes for each level of the game or use one scene and then somehow load each level into that scene? What would be the best when it comes to best performance?

That depends on type of game you are going to make.

If it’s something arcade-like with lots of levels with some variations, making a single scene for gameplay and initializing it with different parameters can help you to be sure that there will be no particular levels where you’ve just forgotten to add some scripts or objects and their relations, which leads to accidental bugs. Obviously that way does not help when your levels have not much in common.

On the other hand, making each level to be a separate scene gives you two benefits:

  1. You can make each level absolutely different in comparison to other ones.
  2. Sometimes it’s easier to make lots of levels manualy.

So if to compare this two methods:

  • Making levels as scenes is a straightforward way which takes long time to do and gives you lots of monotonous but easy work to do
  • Making levels as one scene and initializing it with different parameters is a more reliable way and can save you lots of time if you will find a way to generate those levels quickly, but implementing initialization system is a bit trickier in comparison to ‘lots of scenes’ method.

So you should consider if single-scene method will give you enough benefits, otherwise it’s easier to spam those scenes for the god of scenes! :slight_smile:

You can just make a script and when loading different levels you can spawn he objects using Instantiate() to the positions you want. You can also spawn them with a specific rotation or scale if you want to. That would be like:
GameObject a = Instantiate(ExamplePrefab, targetPosition, Quaternion.Euler(targetRotation));
a.localScale = targetScale;