on startup, I want to get some objects in the scene, for my editor plugin
@tool
extends EditorPlugin
func _enter_tree():
var Scene = EditorInterface.get_edited_scene_root()
print( "scene = " + str(Scene) )
this usually works fine, but if the plugin is already open when Godot is launched, the plugin seems to not yet register the loaded scene. it print “Scene = null” !!
also, if we switch scenes, the plugin needs to register the changed current scene. How do I do this?
how do I get the current scene in editor interface, and update it on scene change or once scene is loaded to make sure we are working with the correct nodes in the correct scene?
I mean, I could do this:
func _process(delta):
var Scene = EditorInterface.get_edited_scene_root()
print( "scene = " + str(Scene) )
but that seems repetitive and unnecessary. surely I could only update the the variable with out scene root on scene change to get the nodes within? only once instead of repetitively??