get_nodes_in_group for scene not tree

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DimitriyPS
:warning: Old Version Published before Godot 3 was released.

I need to get a list of objects of a given group in the stage before I add this scene to the tree. How to do it?

var vp_Scn1=ResourceLoader.load(es://Test1.scn).instance()
var vp_Spisok=vp_Scn1.**get_nodes_in_group("Predmet")**
~
get_tree().get_root.()add_child(vp_Scn1)
get_tree().set_current_scene(vp_Scn1)

And the get_nodes_in_group() method doesn’t work?

rredesigns | 2017-06-12 02:17

Works when:

get_tree().get_nodes_in_group("Predmet")

but for scenes not added to the tree is not working. But I need to get the list before the scene will be added to the tree

DimitriyPS | 2017-06-12 12:28

Well, untill you add the child to the scene it is outside the tree, so I’m not sure you can access it’s children, because the node wouldn’t even be processing yet I think.

Maybe you can hide it, then add it, do what you need, hen unhide it. I need to test some more, if you have a test scene to spare that would be great.

rredesigns | 2017-06-12 13:45