Godot Version
Godot 4.3.stable
Question
Hi! So in my project, I have a scene loader script which works COMPLETELY fine in the editor:
extends Node
var loading: bool
var load_status
var loading_progress: Array
var curPath: String
func load_scene(path: String):
if not FileAccess.file_exists("res://scenes/" + path + ".tscn"):
print("SCENE DOESNT EXIST")
return
print("LOADING SCENE")
curPath = path
loading = true
ResourceLoader.load_threaded_request("res://scenes/" + curPath + ".tscn")
func _process(delta: float) -> void:
if loading:
load_status = ResourceLoader.load_threaded_get_status("res://scenes/" + curPath + ".tscn", loading_progress)
if load_status == ResourceLoader.THREAD_LOAD_LOADED:
var scene := ResourceLoader.load_threaded_get("res://scenes/" + curPath + ".tscn")
get_tree().change_scene_to_packed(scene)
loading = false
The problem is, when exporting, any scene I try to change to just doesn’t work at all? From what I’m getting at, the scene file just doesn’t exist because the if not FileAccess.file_exists("res://scenes/" + path + ".tscn"):
check returns true.
I’ve tried setting the export settings to:
- Export all resources in the project
- Export selected resources (and dependencies)
- Export selected scenes (and dependencies)
and none of those worked. When checking the .pck file, I DO see mentions of the scenes I’m trying to change to, so idk.
Any help is appreciated, thank you!
Edit: I forgot to mention the scene loader script is a global autoload script but idk if that information’s helpful at all with this lol