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:


or, it’s path via:


So, something like this should work:

if get_tree() == "my_scene_name":
    # do something

… or …

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