Cant get node path right :/

Godot Version



With my last project ( flappy bird test ) i use panels and labels as a point UI on screen but now i cannot reply this … I cannot get right node path to rewrite label even if i copy path from it it dosnt work . i try restart godot i try do the panel inside parrent player … i copy the sollution from working flappy bird game and still nothnig . im despred …

The dollar syntax is a shortcut for the get_node method. So this is the same:

%coins_label.text = "..."
get_node("coins_label").text = "..."

Now - the get_node function only searches the node’s children. So %coins_label is looking for a child named “coins_label”.

So it depends where in the scene is your script. From the name I assume it’s an autoload. Autoloads have no children by default, so this getting of nodes doesn’t really make sense inside them. Try switching your scene view to Remote mode to see how your game really looks while playing. You should see your autoload just floating at the top level. This should help you understand the node structure better.

Screenshot 2024-06-09 at 20.28.35

I’d probably advise you to create a variable for the coins label in the script and assign the label into it. Like this:

var coins_label: Label = null
func _ready() -> void:
    Global.coins_label = $coins_label

That’s probably what you want. Also it decouples the global script from the game structure a little bit.

1 Like

it work . i just must restructuring the nodes . ty for simple and good explane. it helpt a lot

1 Like