How to know if the scene is running with F6 or F5?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DavidPeterWorks

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.

:bust_in_silhouette: Reply From: Dlean Jeans

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.

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.

DavidPeterWorks | 2019-07-04 06:06