Bestpractices to switch scenes in mobile game

Hi, I checked some videos and guides, but its necessary to clarify once more.
So I have a default mobile game with 2 scenes - Main Menu and Game, and to switch from menu to game Im using LoadScene(). So if i have closed the game and open it again LoadScene() will be called once more. And it looks a bit weird, is it just for me?
So if game scene is pretty simple there are no issues to call LoadScene as much as I want?

So the best practice for mobile gaming(without big locations or heavy scenes) just call LoadScene each time I need to switch scene and its totally normal?

It looks very strange that I need to call LoadScene each time I need Main Menu, the perfect solutions for me looks like ‘loading scene’ once, and then switch between already loaded scenes, not load it again each time I need it

You could always take a cue from Nintendo and don’t have a loading screen at all…

How long do your menu and game scenes take to load?

I rarely make loading screens but sometimes insert a black GUI image over the top if my initialization takes more than one frame, just to avoid the camera seeing partial stuff.

The main thing you want is when you poke a button to go somewhere, do something so the user knows it was successful. Don’t just go: flash the button for a few frames, etc., otherwise the user will keep poking it thinking it hasn’t gone.

1 Like

Right now it looks like immediately for both scenes(main menu shows immediately after unity animation) but I dont know is there way to record exact time in millis

So switching between scenes should look like

  1. sleep for few frames with activated button(perhaps hardcode it’s active look)
  2. call LoadScene
  3. Optional displaying black/load screen at the beginning of ‘awake’ method and hide it in the end of ‘awake’?

If you’re using Unity UI buttons, they already have a press/release animation that should play to completion before it generates its event.

If you need a micro pause for non-time-critical stuff like this, I usually just use this handy utility class I made, feeding it 0 for the time, which will make it run on the next frame.

See usage notes at bottom below gist code.

Not ‘Awake()’… Awake will always run instantaneously, or lock up until it is finished running, so it’s’ not helpful for this.

You can declare Start() as a coroutine and yield in it, which Unity will then implicitly run for you as a coroutine. I do this a lot anytime I want a few frames of initialization, then at the end of it just destroy / disable the black loading thingy.

1 Like