October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Add a Loading Screen with a Progress Bar in Godot 4

Keep a Godot 4 loading screen responsive by requesting a scene in the background, updating a ProgressBar from threaded-load status, and switching scenes only when loading completes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Godot 4’s threaded resource-loading API to keep a loading screen responsive: request the scene with ResourceLoader.load_threaded_request(), poll its status and progress over successive frames, then retrieve and switch to it only after it reports loaded.

Why use threaded loading for a scene transition?

A synchronous load or direct scene change can block the game while the destination scene loads, making the game appear unresponsive. Godot’s background-loading tutorial describes requesting resources for background loading, while its SceneTree documentation notes that a direct scene change can stall until the new scene has loaded and is running. A threaded request lets your current loading interface remain on screen while the resource loads.

As an Amazon Associate I earn from qualifying purchases.

The pattern below assumes a ProgressBar at $ProgressBar whose range is 0 to 100. Attach the script to a loading-screen Control and call start_loading() with the destination scene path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Request, track, and switch to the scene

extends Control

@onready var progress_bar: ProgressBar = $ProgressBar

var scene_path := "res://levels/level_2.tscn"
var load_started := false

func start_loading(path: String) -> void:
    scene_path = path
    var request_error := ResourceLoader.load_threaded_request(scene_path)
    if request_error != OK:
        _show_load_error("Could not start loading: %s" % request_error)
        return

    load_started = true

func _process(_delta: float) -> void:
    if not load_started:
        return

    var progress: Array = []
    var status := ResourceLoader.load_threaded_get_status(scene_path, progress)

    match status:
        ResourceLoader.THREAD_LOAD_IN_PROGRESS:
            if not progress.is_empty():
                # The ProgressBar range is 0 through 100.
                progress_bar.value = progress[0] * 100.0
        ResourceLoader.THREAD_LOAD_LOADED:
            load_started = false
            var packed_scene := ResourceLoader.load_threaded_get(scene_path) as PackedScene
            if packed_scene == null:
                _show_load_error("Loaded resource is not a PackedScene.")
                return
            get_tree().change_scene_to_packed(packed_scene)
        ResourceLoader.THREAD_LOAD_FAILED:
            load_started = false
            _show_load_error("The scene failed to load.")
        ResourceLoader.THREAD_LOAD_INVALID_RESOURCE:
            load_started = false
            _show_load_error("The resource path is invalid or no load was requested.")

func _show_load_error(message: String) -> void:
    push_error(message)
    # Replace this with a visible retry or error message in a shipped game.

The ResourceLoader API reference describes the status values and progress output used here. The progress value is a ratio from 0.0 to 1.0; multiplying by 100 maps it to a bar with a maximum of 100. If your bar’s maximum is 1, assign progress[0] directly instead.

Keep the loading interface alive

The loading screen must still exist while the request runs. If starting the transition removes the current scene, the progress UI disappears with it. For a transition that crosses scene boundaries, put the loading interface and transition logic in a persistent manager or autoload; Godot’s SceneTree documentation describes implementing a background-loading screen manually with autoloads and background loading.

Once the status is THREAD_LOAD_LOADED, load_threaded_get() retrieves the resource. This example checks that it is a PackedScene before passing it to change_scene_to_packed(). In a different scene architecture, you can instantiate the packed scene and attach it where appropriate; Godot’s background-loading tutorial demonstrates retrieving and instantiating a completed threaded resource.

Handle progress and loading errors safely

  • Check the request result. If load_threaded_request() does not return OK, show an error or offer a retry rather than beginning to poll.
  • Poll on successive frames. Call load_threaded_get_status() from _process() or another frame-based update. Do not spin in a tight loop waiting for completion.
  • Do not use retrieval as a progress check. If loading is incomplete, load_threaded_get() blocks until the resource finishes, which can stall the main thread. Retrieve it only after the status reports loaded.
  • Handle every terminal state. Stop polling and provide a visible recovery path for THREAD_LOAD_FAILED and THREAD_LOAD_INVALID_RESOURCE, as well as checking that the loaded resource is actually a PackedScene.
  • Use subthreads deliberately. The ResourceLoader reference cautions that enabling use_sub_threads can cause main-thread slowdowns. Leave it at its default unless profiling indicates a reason to change it.

When is a threaded loading screen worthwhile?

A direct scene switch can be adequate for a small scene that loads instantly from cache, but the switch can still stall while loading. For transitions where responsiveness matters, the useful questions are whether the UI stays visible, whether the bar reflects actual threaded resource loading, whether the manager survives the transition, and whether a failure gives the player a way forward. Godot’s documentation does not specify a universal scene-size or loading-time threshold; the right choice depends on the project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What this approach loads

ResourceLoader is for imported Godot resources such as scenes. It is not a general-purpose loader for arbitrary plain-text files: those use FileAccess, and the ResourceLoader documentation cautions that non-resource files are not exported by default. Check the method signatures and enum names against the Godot 4 minor version used by your project; the background-loading tutorial cited here is for Godot 4.4, while the reviewed SceneTree page is marked current for Godot 4.0.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.