I’m using Godot 4.3 `
What am I doing wrong, and how can I fix this line oof code? The problems are explained in # statements in the following uploads.
`
I’m using Godot 4.3 `
What am I doing wrong, and how can I fix this line oof code? The problems are explained in # statements in the following uploads.
`
T.PanelContainer.ColorRect.Button.text seems like a strange call to me, try T.PanelContainer/ColorRect/Button.text instead. Making alot of assumptions with that though.
The $ sign symbolises a child of the node containing the script, while / would allow for calling the child of the child in this context.
What you are doing with t.PanelContainer.ColorRect.text is calling the variable text in the variable ColorRect in the variable PanelContainer in the variable t.
The problem seems to be that you are using . instead of / and $
As explained by @misctisc, t.PanelContainer.ColorRect.Button.text
is not a valid piece of code unless each identifier after a .
is a defined variable in t
. Given that all of the identifiers you use mirror existing Godot classes, I doubt that’s the case.
From what I can derive from your code, your scene (which is assigned to t
) has the following node tree:
t
)
PanelContainer
ColorRect
Button
Assuming that you haven’t renamed any of the nodes, these are also the names of the nodes in t
.
If you want a valid reference to the Button
, you can use get_node()
:
var btn = t.get_node("PanelContainer/ColorRect/Button")
Note that get_node()
uses the name as the ID for the node it’s searching for, not the type. Should you choose to rename a node now, or later, the above code will no longer work. This applies to the use of $
as well which is just a shorthand for get_node()
.
Without a code snippet from the script you’re referencing, it’s hard to know if this is a syntax problem or something else.
You strike me as a beginner in Godot. Perhaps it would do you well to go through Godot Docs | Getting Started?
Let me know if you have any further questions.
Here is a screenshot of the node that calls the resource
PButton is the name of the resource that I created
Have you verified that FB
actually has a value assigned to it? Given that you don’t @export
the FB
variable and assign anything to it, I can only assume that it is Nil
. Since Nil
does not have SetValues()
, an error will occur.
No, I have not verified the FB variable