Just have a scene for only your player.
More random scribbles about Additive scene loading:
I always favor breaking the scenes up and loading additively.
reduces overall memory consumption
lets multiple team members trample on each other less often
ensures clean “reset” of all objects in a fresh loaded scene
I’m working on a game now where we each have our own “content” level, the level we’re working on.
the content scene has all the lighting baked in.
Just press play and that level has one script that additively loads:
music scene (just an audiosource on autoplay)
the …
Glad you asked… going this route definitely requires slightly-higher awareness of what scene is what.
In no particular order, responding to you questions,
When the game or level is over, I try to go to a fresh “end level” scene (not additively!) and clear everything else out (except overall ongoing game manager obviously, as a singleton)
when the game gets paused I stop time and bring up a pause scene that sorts above all else, then unload it and restart the time. OR if you quit, I just …
There are underlying reasons this happened and you can track it down by examining everything about each scene’s canvas setup and scaling that are different from the other.
But keep in mind it might not be super-easily to address it in the general case, especially if you start partitioning your UI into chunks.
An alternate workflow is to put chunks of your UI into separate scenes and then load those scenes additively.
For instance you might have the following scenes, all loaded additively:
c…
A multi-scene loader thingy:
My typical Scene Loader:
Other notes on additive scene loading:
Why not remove the player from ALL your scenes, put him in his own separate scene, then load scenes additively?
That way you don’t even need a Player prefab at all, just have a Player scene and load him additively.
I tend to break up all my games into partial scenes, all additively loaded by the game manager:
UI
player
enemy manager
other stuff?
and then finally I load the content scene.
The first batch of screens all have scripts that do nothing until the content scene appears and they kn…
Timing of scene loading:
If line 8 relies on something being present from the scene load in line 7 (in GameController), it won’t be: scenes are loaded at the end of frame and would never be available until the next frame, at the very earliest.
You can trivially make void Start() into a coroutine by declaring it to return an IEnumerator, then put a while loop (with a yield return null; in it!!!) to wait until the scene loads and you find the “Trains” object, then proceed.
Obviously you would need to interlock other thi…
Also, if something exists only in one scene, DO NOT MAKE A PREFAB out of it. It’s a waste of time and needlessly splits your work between two files, the prefab and the scene, leading to many possible errors and edge cases.
Two similar examples of checking if everything is ready to go:
I think multiple scenes are definitely worth chasing. You need to make everything in your game tolerant of perhaps not having stuff ready at the same time, and you have to track things that you need only ONE of:
Camera (Main)
Audio Listener
EventSystem
I like to put all of those in the BASE scene if possible, then load other scenes like UI and pause and the level itself, etc.
You have to sort of figure out which works for you. You can actually make Start() be a coroutine too, such as lookin…
Indeed. I like to use a lot of additively-loaded scenes, so I tend to code my individual item controllers (including the player controller) so that they are happy to wait around if other stuff isn’t ready yet.
You can make Start() into a coroutine, which is a super-easy way to get this kind of lazy-sloppy startup that is extremely tolerant of late loading and uneven loading.
// typical base framework for all entities
bool ready;
IEnumerator Start ()
{
// don't proceed unt…
1 Like