0 votes

Hello guys !

I've a question there :

  • How to make a proper transition when loading scene ?

I explain:

Currently , I have a "RootScene" with a Script. In this script, in the _ready() function, I load 4 big scenes, then instantiate them and stock them in my Script's var.

Then, I just have to add_child() or remove_child() theses instances in my script to switch between the 4 scenes efficiently and without any loading time.

But then, a problem occurs : Because my scenes are huge, The game take some time to launch. And, obviously, more and more as my scenes grown bigger and bigger.

In order to have something more "clean", I made a "launcher screen", a little animation scene, which launch when opening the game (and so the game open really fast, as the scene is really little). And next, after the animation, i wanted to switch to my RootScene.

But, obviously, the time that was previously used to launch the game is now used between my LauncherScene and my RootScene.

So I wanted to make something like a "progress bar" as a transition between my two scenes, for having something "fluid" instead of waiting face to face with a black fixed screen.

I've read http://docs.godotengine.org/en/stable/learning/features/misc/background_loading.html but it doesn't seem to work, so I ask myself how can I do this ?

in Engine by (42 points)

Just a comment, if your scene is too big but does not need everything loaded right away, you can use instance placeholders and load only the immediate and the rest while running.


why is the background loading as described in that link, nor working ?

Not sure, the way you load/preload the scenes and the scene structures may affect it.

2 Answers

+1 vote

Hello !

So, it seems I had misunderstood how the "background loading" works.

In fact, when doing background loading on a scene as the tutorial shows, it does, but ONLY for this specific scene load.

I explain.

Imagine we have this structure :
-- load "Root.tscn" (2 fragments in a loader)
---- load "Subscene1.tscn" (7 fragments in a loader)
---- load "Subscene2.tscn" (8 fragments in a loader)
---- load "Subscene3.tscn" (4 fragments in a loader)

In this case, HelloLogo load Root, and Root load the three subscenes.

If you do background loading in HelloLogo to load Root, it will ! But it will ONLY fragment Root. Not the subscenes. So you will have only, like, 2 steps (which is fairly useless for a progress bar, yep ?). Then Root will load normally his subscene, and it will freeze.

To have it work correctly, you must do the BackGroung loading in Root for the subscenes, in my case. That means, load Root from HelloLogo, and then in Root, background load all subscenes in order to have (7+8+4 = 19) fragments, which is a better progress bar, and will have no freeze.

If anybody has a clue about a "backgroundloading" that fragment also Subscenes from the loaded Scene, however, that could be really helping for other cases. But I doubt it exists.

by (42 points)
edited by

can't you preload all subscenes into the ready function of the root node ?

0 votes
by (208 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.