0 votes

How to open a sceneA (.tscn) directly in the editor (not when playing the game but when editing it) using other sceneB with a script (.gd)?

The sceneB is using the "Tool Mode" (tool in the top of script) and have a button with the relative path of sceneA.

The idea would be to click the button in sceneB and open the sceneA for editing directly in the editor, in a new tab.

in Engine by (34 points)

1 Answer

+2 votes

I don't think a simple tool can interact with the editor, you may need to make a plugin and with the EditorPlugin use edit or edit_resource.


by (7,888 points)

Another option that involves a lot less work would just be to create an EditorScript that gets the EditorInterface during the _run method and uses it to set the current scene in the editor. You can then easily run it by going to the ScriptEditor, opening the script, and hitting Ctrl+Shift+X to run it.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.