Pulse Works Studio

Parse Error: Unexpected identifier "onready" in class body.

onready is now the @onready annotation. The bare word is a parse error.

Cause

Godot 4 turned onready into an annotation that runs the initializer when the node enters the tree. Leaving the Godot 3 keyword in front of var is the same class of mistake as a bare export: the parser does not expect an identifier there.

Fix

extends Node2D

@onready var sprite: Sprite2D = $Sprite2D
@onready var camera: Camera2D = $Camera2D

func _ready() -> void:
	sprite.visible = true

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.