The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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?

in Engine by (28 points)

1 Answer

0 votes

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)
by (1,646 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.