0 votes

Is there any way to know if the scene is running by F6?

I have a global autoload scene sequence manager solution. It manages the sequences of the scenes. I have more than 10 scenes in this manager.

F6 would be easy to test specific scenes, but the autoloaded scene sequence manager takes over.

My goal would be that if F6 is triggered the autoloaded scene sequence manager would not execute its default scene sequence.

in Engine by (300 points)

1 Answer

+2 votes
Best answer

You can do a check with this function:

func is_f6(node:Node):
    return node.filename != ProjectSettings.get_setting('application/run/main_scene')

It basically checks the node against the Main Scene set in the Project Settings.


I'd recommend against using singleton in this case, unless you really have to or know what you're doing. What I would do instead is create a bigger scene containing this scene sequence manager. So you would never need to deal with something like this in the future.

by (4,101 points)
selected by

Thanks. It is a perfect solution at this point.

You are right about the second recommendation. I will build a Scene container scene later.
Thank you.

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 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 webmaster@godotengine.org with your username.