Aego Playground

Scripts and lifecycle

script Enemy {
	@export var Speed float = 120
	var elapsed float

	signal Died()

	func Ready() {}
	func FixedUpdate(dt float) {}
	func Update(dt float) {}
	func Reloaded() {}

	func helper() int { return 1 }
}

Lifecycle methods are recognised by name and must have exactly these signatures:

Method When
func Ready() once, after every instance in the scene exists and references are resolved, in scene pre-order
func FixedUpdate(dt float) every fixed step, before physics, in instance creation order
func Update(dt float) every frame, in instance creation order
func Reloaded() after a hot reload, for every instance whose script or a dependency's interface changed (§19)

Instances that do not declare a method are not visited for it; a scene with ten thousand instances that never declare Update costs nothing in the update phase. Lifecycle methods cannot be coroutines (AES2056), cannot be signal handlers (AES2055) and cannot be called through a ScriptRef (AES2059).