Calling _ready() manually also re-initialises all @onready variables

extends Node

@onready var test := 0

func _ready() -> void:
    test += 10
    print(test)

func some_func() -> void:
    _ready()

This first prints 10, and then, when you call some_func() at some point, it prints out 10 again, because test was reset to 0 due to it being an @onready variable.

Nothing crazy, and I understand why this happens, just thought this was funny behaviour because I didn’t expect it.

4 Likes

That’s why it’s called “on-ready” :smiley:

2 Likes