Topic was automatically imported from the old Question2Answer platform.
Asked By
StsDevSquad
I have a group in my main scene called minimap_objects, and objects that are in that group show up on my mini map. If I try to preload the scene in code with a spawner it spawns the object , but not in the group, but if I drag the tscn file to my main file it shows up in the group. Any ideas?
First of all (pre)loading does not produce a Node, instance() does.
Second, Groups are no more than simple string tags, so they are simply loaded, not “into group”.
Moreover, Groups are managed by SceneTree, so node has be added to a tree, for a Group feature to work.
You can always check which nodes in tree belongs to a certain group with
var myGroupNodes = get_tree().get_nodes_in_group ("minimap_objects")
print(myGroupNodes)