Creating a Scene Loader singleton with Loading Screen

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Walker32102


As a beginner game developer, I recently started using Godot 4 and found it to be user-friendly. However, I’m facing a challenge with background loading and creating a SceneLoader singleton. I want to avoid duplicating code in multiple scripts, but I’m not sure how to approach it. I’ve watched tutorials, but they were either for Godot 3 or written in the script attached to a scene. Furthermore, I tried writing my own, but no progress so far. Can you offer any advice on how to tackle this problem? I’d really appreciate your help!

Thanks in advance!

:bust_in_silhouette: Reply From: deaton64


I’m slowly converting a project from Godot 3.5 to Godot 4 and background loading is making me give up or wait until it’s improved a bit.

There’s a few issues on Github that are outstanding for it.

Resource Loader sub threads not working

Resource Loader progress status not working

I’m using the ResourceLoader class to load my scenes, like this:

var _error = ResourceLoader.load_threaded_request(_scene_name, hint, thread_load, cache_mode)

Then I check the status in the process funtion:


0 = invalid, 1 = loading, 2 = failed & 3 = loaded.

Not exactly what you asked for I know. Not all things are complete in Godot 4 and I think this is one of them.