Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | a human |
Can I instance individual nodes from an alternate scene instead of the whole scene? If so, how?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | a human |
Can I instance individual nodes from an alternate scene instead of the whole scene? If so, how?
Reply From: | njamster |
You mean, instead of instancing a scene like this…
- Node 1
- Child 1
- Child 2
… you would like to instance only, let’s say, the node “Child 1”?
No, you cannot do this. However, you can right-click on a node in the tree and select “Save Branch as Scene”, save this scene and then instance that.
#placing
if can_place == true:
if Input.is_action_pressed(“ui_select”):
var tile_resource = load(“res://tiles.tscn”)
var tiles = tile_resource.instance()
var tile = tiles.get_child(0)
tile.get_parent().remove_child(tile)
get_node(“…”).add_child(tile)
tile.set_position(mousepos)
tile.set_rotation(rotation)
this works!!!
tree:
node2d
-rigidbody
a human | 2020-03-22 19:43