Is it possible to add a custom node type to the node creation browser based on a scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Spyrex

Using add_custom_type I tried to create a node with custom behavior. The problem I ran into, was that you are only able to create a custom node based on a script, but I need to create one based on a scene, that also has children nodes.
Is there any way to create a custom node based on a scene?

I’m not sure if you can do that. What about an inherited scene?

exuin | 2021-06-06 06:47

:bust_in_silhouette: Reply From: Wakatta

The only solution i can muster up is to use tool

Unfortunately the following is an estimation and has not been tested
So it may not work as intended

tool 
extends Node
class_name My_Custom_Node

func _enter_tree():
    if Engine.editor_hint:
        var packed_scene = load("custom_node")
        var custom_node = packed_scene.instance()
        self.replace_by(custom_node)
        custom_node.set_owner(get_scene())

Or you can try the plug-in way which should get you the results you expect