+1 vote

Hello all again, I want to check if a certain scene exist. How can I do that?

in Engine by (171 points)

2 Answers

0 votes

You can check if a file exists using:

You can also see examples of how to use the File object farther up that page.

by (21,577 points)
0 votes

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)
by (263 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.