I have multiple scenes, when I press the “Back” button in the game, I want to be able to change scene to the last scene before the current scene.
So, before I do get_tree().change_scene() I want to store the path to the current scene in a global.array, so that in a future scene I can return to the last scene stored in the global.array.
As above, this too should be a Comment, not an Answer. Otherwise, people looking at the forum overview page may ignore the question as it already appears to have been answered.
Nodes have a filename property. If a node is the root of a scene instance (like the current “scene” is), filename will contain the path to the scene file.
For anyone using Godot 4.0; filename has been renamed to scene_file_path.