Replies: 1 comment 2 replies
-
I don't really like this as proposed. It could be on purpose too. To me, making this stricter would be useful only if we got a warning/error only if such variables aren't assigned to, neither inside @onready var node1: Node = $Node1 # initialized by start of _ready
@onready var node2: Node # must be initialized by the end of _ready; perhaps also before any await instruction
func _ready() -> void:
if debug:
# complex logic...
node2 = $Node2_Debug
else: node2 = $Node2
# would be error if node2 were not definitely assigned by the end of _ready Since we're explicitly saying it's initialized |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In a line like this:
The
@onready
annotation has no meaning since the variable has no initialization. It could be that we forgot to write one.Beta Was this translation helpful? Give feedback.
All reactions