#Custom class with tool script

4 messages · Page 1 of 1 (latest)

winter swallow
#

I have a scene called Interactable, that has a sprite with an outline that can be controlled with exported variables. The script for it is a tool script, so that when I change the outline's parameters, it's immediately visible in the editor. I want to make another scene that would extend from this one, but when I try making Interactable.tscn the root of another scene, it says "Instantiated scenes can't become root". So I set Interactable's class_name to make it a custom node, but now when I add it to a scene and try changing its parameters, an error is shown saying that it can't access its local node children anymore. Is there any way to make a custom node that also uses a tool script, or are there any other ways of achieving what I want to do by other means (have the node both react to changes in the editor but also be able to make another node that extends from it)?

wanton leaf
#

if you make an instance of a class (script) by itself, it doesn't come with any scene nodes (because the script is completely independent from the scene), so that's why they're not found

#

you can still do what you want by creating an inherited scene (right click your base scene file to get the option to make an inherited scene from it), then in that new scene, you can change the script of the root node

#

effectively, an inherited scene is a scene where the root node is a scene instance, there's just an arbitrarily different way of creating one in the editor