Gapless Scene Change

Godot Version

v4.2.stable.official [46dc27791]


This might be a silly simple question, but sometimes when I’m changing scenes via “change_scene_to_file()”, there’s one frame in between where instead of showing either scene, it just shows the grey editor background. Is there a way to ensure that this doesn’t happen?

If scene loading takes anywhere longer than one frame, you will see that gray screen. The bigger your scenes, the more apparent the effect.

You need to build a proper loading screen, as most games do, to hide the stuff that happens between scenes, since loading can take up several seconds.

1 Like

i would rather make something like a switch scene function that a core/main controller has, so it doesnt need to call change_scene_to_file() to remove whole scene. with this you can add loading etc while switching scene to another without delay

something like this:

func switch_scene(scene_path: String,level=-1):
	var current_scenes = scene_node_container.get_children()
	var scene_count: int = current_scenes.size()
	if (scene_count > 0):
		loading_panel.visible = true
		await get_tree().create_timer(0.1).timeout
		for child in current_scenes:
		var new_scene = load(scene_path).instantiate()

		await get_tree().create_timer(0.4).timeout
		loading_panel.visible = false



Thanks to everyone involved. I’ve made a proper loading screen today. Solves the problem and looks more professional too!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.