Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | savitljiv_pauk |
Hello, I am working on a level editor in my game and I am stuck on instancing nodes.
I have created a user interface that I reuse and saved it as a scene. I added it to my level editor scene, but the buttons I use to instance nodes in my level editor are in the backgroundGUI scene
func LoadInstance(path):
var scene = load(path);
var instance = scene.instance();
add_child(instance);
func _on_Ice_pressed():
LoadInstance("res://Objects/Ice.tscn");
func _on_Sand_pressed():
LoadInstance("res://Objects/Sand.tscn");
This is the player creates objects.
It is created in the control scene, but I want it under LevelEditor, where PseudoPlayer is. I have searched online and haven’t found a way to do it.
I would be willing to rework this system because it’s kinda clunky and I just want it to work so I can continue with my project. Thanks
Maybe you could just add the UI as a child of the main scene, then make it invisible using .visibility until you need it again. This way, you can add signals to the LevelEditor, which instances as it’s child
PhantomPixel | 2021-11-04 02:39