2
\$\begingroup\$

What is the different between LoadSceneMode.Additive and LoadSceneMode.Single? When should I use one, over the other? I read the documentation, but I can't find any good examples of use for a definitive situation.

\$\endgroup\$
6
\$\begingroup\$

The document is actually pretty self explanatory, though the documentation for the new implementation is not as helpful as the original documentation. Let's take a look:

LoadSceneMode

enumeration

Description

Used when loading a scene in a player.

Variables

Single          Closes all current loaded scenes and loads a scene.
Additive       Adds the scene to the current loaded scenes.

This tells us everything we need to know about the two; If you use LoadSceneMode.Single, you close the current scene, and load the new scene. If you use LoadSceneMode.Additive, you leave the current scene open, and load the contents of the additional scene into the current scene.


If you were to have a game with distinct levels, where a player directly moves from one level into another, you would probably use LoadSceneMode.Single. Think of it like a level of "Super Mario Bros." or "Rayman". Once you move in to the next level, you do not want to use the contents of the previous level. You might be able to move from level one to level two, and you might even be able to move back to level one from level two; but you would not be able to be in both level one and level two, at the same time.

If your player only explores distinct levels, at a time, you would most likely use 'LoadSceneMode.Single'.

If you were to have a game with one big game world, where the player can freely move around in an open world, you might want to only load areas of the game world specific to the location of the player. Think of it like the game world of "The Legend of Zelda: Ocarina of Time" or "The Elder Scrolls IV: Skyrim"; areas would be broken up into sections, in this case "scenes", and only loaded when relevant. There is no reason to need the parts of the world on the complete opposite side of the game map, for example; why waste memory by having it loaded, anyway?

A larger game world may be much easier to manage, by loading it in in chunks, using 'LoadSceneMode.Additive'.

In the above example, the player would always be in the game world; however, you would only keep neighbouring scenes loaded. If I was in the area marked as "1", you might only have "1" loaded. If you wanted me to see out into the game world, you might only have as far as "2", "5" and "6" loaded. If you wanted to get really tricky, you could implement a "vision distance" parameter based off player input and/or user hardware capabilities, and allow your game to load in as far back as "12"; but only if the user computer can handle all the additional data, in the local memory. As I move to the area marked as "2", you might choose to load "3" and "7", in anticipation of moving into further areas. If I continue on into the area marked as "3", you might choose to unload "1" and "5", while you load "4" and "8", assuming I am too far from the unloaded area to even notice the fact that the area is not currently loaded.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.