Okay I'm sorry if this is a dumb question but I'm new to godot so I still don't understand everything :D
I have a script attached to a VBoxContainer and inside this container i have a Label: "fingerCounterLabel".
The problem is when I try to access the Label in the script I get the error that the Label is a null instance, so that the script can't acces the label.
And yes I have checked if the Label name is written correctly and I have checked if the label really is inside the VBoxContainer but I still can't get it to work
#Cannot access Label in script
17 messages · Page 1 of 1 (latest)
When do you call the function?
when i press a button which is in another script
try getting the label with @onready var finger_counter = $fingerCounterLabel on top of your script and see if that works. Have you checked the remote tree on runtime?
Sadly this still does not work
and do you mean that i should check if the label exists on runtime?
yes.
idk if thats correct but when i look into the remote tree while running the script i can see the label
Are you sure your code is in the correct script? Or maybe there is something funky going on with your other scripts
yeah the code is in the correct script but i can see if i can arrange the scene a bit differently and check if that works
Can you also send the whole scene tree?
and another side question if i just want to group different nodes together what node should i use for that cus i used the canvasGroup but i dont think that thats correct
try right clicking on the label and setting it to unique name (%)
Then use %fingerCounterLabel to access it
That's indeed not good practice. If you don't want to automatically order them, use just Node2D
still not working like i said im probably gonna try to rearrange the scene a bit to see if i can somehow make it work
okay thank you for the tip :D
No this def should work. I think there is something going on with your scene!