Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Asoth |
hello,
I want to expand a node_A (adding child) from a script attached to this node_A :
Ok I know it is not possible to do it directly but I cannot understand or make work any suggestion found on the net.
call_deferred produce nothing
request_ready():, I got no clue where to put it
func _ready():
var position= Position3D.new()
position.set_name("posi")
add_child(position)
print_tree_pretty()
the most upsetting thing is that print_tree_pretty print exactly what I want to do. but nothing appear on the right panel
when I use this
call_deferred("add_child",position)
print_tree does not even show any added child
thx
In which context are you doing this? Is it in game or in editor with tool
script?
Zylann | 2018-08-10 12:45
it is actually a code that worked properly as a tool script.
I want to make it do what he is supposed to do on “play” instead of “run”.
and splitting my code into each node instead of putting everything on one big tool script sound less cumbersome.
(i want to create the whole hierarchy of node by script)
Asoth | 2018-08-10 20:51
There is almost no difference between tool
and game
though. tool
just means the node runs in game AND editor. call_deferred("add_child",position)
should have worked. When I test your code it works as well, it prints this:
┖╴Node
┖╴posi
Zylann | 2018-08-10 20:55
well, the “posi” node show up when printed but do not show up in the inspector, at least for me.
Asoth | 2018-08-11 02:31
wait what is the heck with the “remote scene tree” is it actually normal nothing appear in the inspector when I add node from the script while running ?
https://forum.godotengine.org/3619/there-are-have-some-ways-view-scene-tree-when-project-running
Asoth | 2018-08-11 09:05