Search Unity

Having several scenes would be a bad idea? Mobile

Discussion in '2D' started by Gonzasmpl, Feb 21, 2019.

  1. Gonzasmpl

    Gonzasmpl

    Joined:
    Jul 30, 2018
    Posts:
    55
    Hi, i wonder if having lots of scenes for different levels of my game, say 100 scenes, would increase too much the final "weight" of the build if i'm targeting mobile platforms. Almost all the levels are completely diferent from each other, so i dont get to a better solution than having a bunch of scenes. If you know how having 100+ scenes would affect to the final "weight" or think of a better solution, i would like to hear you. Thanks!
     
  2. Fatcat-Games

    Fatcat-Games

    Joined:
    Nov 9, 2016
    Posts:
    34
    You could have a single scene, then make the levels into prefabs. Place those prefabs in your Resource folder, and Instantiate the prefab for the level you want.

    Code (CSharp):
    1. GameObject level = (GameObject)Instantiate(Resources.Load(levelName));
     
  3. Gonzasmpl

    Gonzasmpl

    Joined:
    Jul 30, 2018
    Posts:
    55
    I hadn't thought that, doing it that way should be better than having lots of scenes, right?