Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background loading #33

Open
univeous opened this issue May 22, 2024 · 1 comment
Open

Background loading #33

univeous opened this issue May 22, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@univeous
Copy link

univeous commented May 22, 2024

Is your feature request related to a problem? Please describe.
I've recently considered handing over scene changing in my game to this addon.
However, I realized that it lacks the ability to load scene in background.
without it it's impossible to show the loading screen when loading a large scene.

Describe the solution you'd like
For now I'm using this approach in my own game. I've left out some parts, like the loading screen actually only appears after a certain amount of time has elapsed since loading:

var _target_scene_path :String
var progress := []

func switch_to_scene_path(scene_path: String):
	#...

	await fade_out()
	_target_scene_path = scene_path
	ResourceLoader.load_threaded_request(scene_path, "PackedScene")
	# Show Loading Screen
	LoadingScreen.show()


func _process(_delta: float) -> void:
	if _target_scene_path == "": return
	
	match ResourceLoader.load_threaded_get_status(_target_scene_path, progress):
		ResourceLoader.THREAD_LOAD_LOADED:
			var new_scene = ResourceLoader.load_threaded_get(_target_scene_path)
			
			# Do stuff here to Hide Loading Screen
			LoadingScreen.hide()

			get_tree().change_scene_to_packed(new_scene)
			_target_scene_path = ""
			await fade_in()			
		ResourceLoader.THREAD_LOAD_IN_PROGRESS:
			# Do stuff here to update Loading Screen
			LoadingScreen.update_progress(progress[0])

Describe alternatives you've considered

N/A

Additional context

N/A

@jabsatz jabsatz added enhancement New feature or request help wanted Extra attention is needed labels Nov 22, 2024
@jabsatz
Copy link
Collaborator

jabsatz commented Nov 22, 2024

Hello! As mentioned in the post here #35, I don't think I will be able to add this feature personally. I have tagged the issue however, in case somebody else can pick it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants