Godot not returning nodes in global group?

Godot Version

4.4

Question

I have assigned a node to a global group:
image

but when I try to get the node in another scene via:
@onready var score_text = get_tree().get_nodes_in_group("test")
I only get an empty array returned. If I run the script in the same scene it works just fine.

Am I missing something?

I haven’t touched groups yet, I’m just looking through the Docs, if you go in your project settings does it appear under Global Groups or do you have to manually add it? If it doesn’t maybe that is why it isn’t accessible from other scenes.
I’m sure you’ve already looked here but docs link below, hopefully something in there helps

Is the node you’re looking for in the scene tree when the score_text variable is ready? If the scene isn’t loaded then the tree won’t be able to find the node.

1 Like