Get first node in group always returns Null

Godot Version

4.4

Question

I have put a menu into a group called “Menu” and am trying to get it via
@onready var menu = get_tree().get_first_node_in_group("Menu")

But that only returns Null and I have no idea why.

Here are some screenshots of the node, as far as I can tell it has the right group name and there is no other node in the group.

when I access the size of the group I get a 0 returned, so somehow the node wasn’t added to the group. Am I doing something wrong? Feel like I am going crazy

What node is the script that needs to find the menu on? onready only is evaluated when that node is ready, not necessarily when the menu is also ready.

ahhhh I forgot to add the scene to the scene tree, now I feel silly :sob:

thank you so much :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.