Instantiating prefab vs loading new scene


I have a long linear level (kind of an endless runner). It is segmented into, well, sections (containing a series of jumps or puzzles). There are two ways I can handle this:

  1. Make every section in its own scene. Since both player and camera DontDestroyOnLoad(), there are occasional hiccups (loading scene) but it is a continuous experience. Advantage: Scenes are easy to edit. Disadvantage: Loading scene is heavy operation.
  2. Make the segments into a prefab each and put them all into one scene. They will be instantiated and destroyed as the player is onTriggerEnter() and onTriggerExit(), respectively. Note that the scenes from option 1. and the prefabs from option 2. contain the same objects, they are basically equivalent. Advantage: Maybe prefab instantiation / destruction are faster than loading scenes. Disadvantage: Inconvenient to edit; most prefabs must be erased from hierarchy before running since they are instantiated in runtime.

Which would you favour / recommend? I am inclined to 1. since scenes are easier to edit. Curious to hear your opinion.

You could have the “to be yet seen” objects simply inactive. They would probably take very little memory – possibly just as much as prefabs+spawning code. And, you could edit them right there and check them inactive when done. For ease, put each 50 foot section into a parent object.

For prefabs, the 50 foot section trick might help. Could edit each section normally. When done, drag them all into their prefabs and delete. The cool part is, dragging into the Heirachy pane will put them where they started (unlike dragging into the Scene, which picks a new position.) Spawning them could also key off the preFab position.

Prefabs with prefabs in them (like a long hallway with only prefab benches, lamps … ) should still give all the space-saving advantages. For example, if section 12 is the same as section 5, could just drag the section 5 prefab into S12, with the new location (and some extra plants or something.) The section 12 prefab will only need a handful of bytes to store the location and the S5 link.