![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | DarlesLSF |
Hello all again, I want to check if a certain scene exist. How can I do that?
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | DarlesLSF |
Hello all again, I want to check if a certain scene exist. How can I do that?
![]() |
Reply From: | kidscancode |
You can check if a file exists using:
https://docs.godotengine.org/en/latest/classes/class_file.html#class-file-method-file-exists
You can also see examples of how to use the File
object farther up that page.
![]() |
Reply From: | luislodosm |
For example:
export(String, FILE, "*.tscn") var path_to_scene
func change_scene():
if ResourceLoader.exists(path_to_scene):
var _error = get_tree().change_scene(path_to_scene)