Interacting with the inspector from a running scene's script

Godot Version

v4.4.1.stable.fedora [49a5bc7b6]

Question

I’m putting together a simple scene to run part of my game alongside controls for creating and selecting resources that control the difficulty. I don’t really want to recreate the whole inspector UI to edit the resource, I’d rather use the embedded game window and the editor inspector.

Is there a way to control the editor’s inspector from a running scene? In order to tune my game’s difficulty I want to tweak the difficulty resource and have it applied in real-time.

This already works if I navigate to the resource and edit it in the inspector while the scene is running, but I’d like to have the scene script automatically load the resource I’m working on in the inspector without me having to find the correct one manually.

I tried to use EditorInterface.get_inspector() but that gives me an error when I run the scene that the function does not exist.

Is there a proper way for me to get access to the inspector? Or, is there a more idiomatic way to have a scene designed as a tool for editing game data?

You can’t directly access the editor from a running game. You’ll need create a plugin and use the EngineDebugger to send and receive message to and from the editor and an EditorDebuggerPlugin to send and receive messages to and from your game.

An example of how to do it is here 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

1 Like

hm, that’s a bit more obtuse than I was hoping for, but seems like a reasonable way to go. Just trying not to have to build my own resource editor for a development tool. Thanks for the pointers :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.