Get game scene tree from editor window

Godot Version

4.4.1

Question

How can I get the game’s scene tree from an custom editor window? I have an editor tool which needs to get the current game state and save it as a ‘snapshot’ which can later get booted into again based on the selected config. I tried running Engine.GetMainLoop() and looked into others, but couldn’t find a way so far.

If you want to be able to communicate between your game and editor then you’ll need to use EngineDebugger to send and receive information from your game to the editor and write a EditorDebuggerPlugin to capture those messages and send back commands from the editor to your game. Here’s an example Godot 4.x example of how to launch multiple instances and tile them by using an editor debugger plugin to communicate with each instance · GitHub