How do i sense wich scene im currently at

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

So this is sorty how i thougt it whould work

if scene.current = "path to scene":
     Print("Hello world")

But obviously it don’t work like so how am i sopposed to do

:bust_in_silhouette: Reply From: jgodfrey

You can get the name of the current scene via:

get_tree().current_scene.name

or, it’s path via:

get_tree().current_scene.get_path()

So, something like this should work:

if get_tree().current_scene.name == "my_scene_name":
    # do something

… or …

if get_tree().current_scene.get_path() == "/my/scene/path":
    # do something