![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | mostafa mahmoud |
First i went on forums and tried a lots of ways to implement variables at any text form and that is the variable i want to implement
extends Sprite
export var speed = 1
and the RTL is a child to the sprite which has the script
and that is my trial to implement the RTL to the script
func _process(delta):
.......
onready var rtl = get_node("RichTextLabel")
rtl.text = str(speed)
and then this error comes in Unexpected token : identifier rtl
var rtl : RichTextLabel = get_node("RichTextLabel")
and then it tries to use onready
Do you use the onready keyword inside the _process( ) function?
ener | 2021-10-09 21:18
The code onready var rtl = get_node("RichTextLanel")
can only be used outside of a method. It’s sort of like writing the following:
func_ ready():
var rtl = get_node("RichTextLanel")
The onready
keyword assigns the variable once the node becomes ready.
Ertain | 2021-10-07 09:18
nice i solved the problem my self a while back thanks for the answers
mostafa mahmoud | 2021-10-11 16:20