Search Unity

Making Levels in a platform game / prefabs or scenes?

Discussion in 'Prefabs' started by volcank, Sep 8, 2020.

  1. volcank

    volcank

    Joined:
    Apr 24, 2014
    Posts:
    26
    Hi everyone,
    I have a question. I am about to start a project which I will have levels. I am planning to publish it on various platforms ios, android, PC, MAC etc.

    I was gonna ask if were to make levels for my game which approach would be better. To use scenes and each scene has levels in them or creating each level as a prefab saving it as prefab then calling it back when the level starts. Like if level1 then create object level1 prefab. As far as I know creating extra scene increase the exported file size. But in terms of performance I would like to get your advice.

    Thank you in advance

    Best
     
    Kokowolo likes this.
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Without different scenes you have to update things like fog and skybox procedurally between levels. And for WebGL, I've found with mobile browsers in particular that the only way to get GC to cooperate fully is unloading the scene - even with everything in profiler being clean. The downsides are that for multiple scenes you'll have to handle persisting data between them, it's more complicated to create interesting transitions and there can be a bit of a wait between scenes vs. almost none with prefabs.

    If you have several levels that aren't using a lot of memory and they all have the same environment settings, it might make sense to reuse that scene. For example if you're structuring them as World 1-1, 1-2, 1-3, 2-1.. you might decide that transition to a new scene is only necessary when reaching 2-1.

    Also you only need to bother having 1 scene of a kind.. that is to say, if 10 of your levels have the same sky and so on, you don't need to make 10 scenes or you'll complicate things for yourself - just 1 scene that any of those levels can be instantiated within when it loads.
     
    volcank likes this.
  3. volcank

    volcank

    Joined:
    Apr 24, 2014
    Posts:
    26
    Wonderful! Thank you so much for this. So in a way if I have like 4 world with 20 levels this equals to 4 scenes and 20 prefabs of levels I guess.This makes things more packed and manageable. I appreciate your advice thanks a lot.
     
    adamgolden likes this.