- Home /
Additive scene loading or dont destroy on load?
Hello, I don't know what is the best and more efficient way to organize my scene manager. I'm developing an AR game (with DreamWorld glasses) that has 3 scenes to appear (language and avatar selection) before the main game scene. The architecture now is like this: 1) Main basic scene that contains the camera, a cannon gameobject and other environment stuff that I will need in all scenes 2) Language Selection Scene that contains the game objects for language selection (flags, etc..) 3) Avatar Selection Scene that contains all avatars and their description and other objects 4) Main Game Scene containing all the effective game.
For know I'm loading first the Main basic scene and in additive mode the language scene. When I'm done with language selection I unload the Language selection scene and again load in additive mode the avatar mode, and again till the main game scene.
Is this the right way to do that? In the end I will have unloaded Language and Avatar scene, and loaded for the rest of the game the main basic scene and the main game scene.
Is it better like this or it's better to put all the stuff that is in main basic scene in a DontDestroyOnLoad mode? Is additive mode handled like this a bad practice?
Thank you very much!!
Answer by kromenak · Jan 31, 2020 at 11:01 PM
What you describe sounds like a fine solution. I'd argue that there are a lot of different ways to implement the desired behavior. At a high level, you've got two tools: scenes and prefabs.
A very simple game might have all objects for menus and gameplay in a single scene, and you simply activate/deactivate game objects when they're needed. But as games get larger, you may have a need to split things up into multiple prefabs or scenes.
One reason to split stuff up would be that it makes the content easier for multiple people to edit. If everything is in one scene, you might get a lot of merge conflicts from version control. Creating separate prefabs or separate scenes (or both) makes it less likely you'll make a conflicting change to a file.
Another reason to split stuff up is to organize what needs to be in memory at the same time as other things. On a project of mine, we used two scenes (Frontend and Gameplay). All the menus were not needed during gameplay and the gameplay was not needed during menus. So, we just load between the two as needed. Anything that needed to persist for the entire duration of the game was marked "don't destroy on load."
Anecdotally, I have had concerns that loading new scenes (additive or not) may incur some loading time or at least a small performance hitch. However, this might be fine with newer Unity versions, or maybe I was doing something wrong at the time. But do consider that loading a scene is probably more work for the system than simply toggling a GameObject on/off. Especially if you want seamless transitions between menus or something like that, it might be better to put multiple menus in a single scene.
So, I think organizing in different scenes and additively loading as needed is fine. Your alternatives might be to put the stuff in the scenes into prefabs and then Activate/Deactivate instantiated prefabs as needed, or maybe put all non-gameplay stuff into one scene and gameplay stuff in a different scene. Using "don't destroy on load" is mostly great if you need something to persist between scene loads - most commonly a manager class or something like that.
Answer by austephner · Jan 31, 2020 at 10:52 PM
For me personally, I start the game with a scene that loads all my singletons (like translation management, input management, etc.) then sends the users to a new main menu scene where they can do stuff before playing the game (loaded in separate game scenes). But really it depends on the nature of your project and what suits you the best. I've seen single-scene projects and they tend to be very messy when not handled correctly. Having multiple scenes comes in handy for sure.
Your answer
![](https://koobas.hobune.stream/wayback/20220612222449im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 4.6 UI Touch Detection 1 Answer
[Unity 4.6]Anchor element top side to the bottom side of another element. 0 Answers
U4.6 - Equivalent command to NGUI's UIButton.current to detect which button was clicked 1 Answer
DX11 shader model 5 unavailable 0 Answers
Mesh Collider is Hiding Capsule Collider 0 Answers