{ debug.log(bean.width)})returns The event controller.The event controller.since v2000.1v2000.1group EventsEvents Open In new tabIn new tab KAPLAY Installing KAPLAY Basics of KAPLAY Components of KAPLAY Resources Start playing around with ..." /> { debug.log(bean.width)})returns The event controller.The event controller.since v2000.1v2000.1group EventsEvents Open In new tabIn new tab KAPLAY Installing KAPLAY Basics of KAPLAY Components of KAPLAY Resources Start playing around with ..." />KAPLAY Docs, onLoad
Function

onLoad

(action: () => void): void

Register an event that runs when all assets finished loading.

param action- The function to run when the event is triggered.

const bean = add([
    sprite("bean"),
])

// certain assets related data are only available when the game finishes loading
onLoad(() => {
    debug.log(bean.width)
})

returns The event controller.

since v2000.1

group Events

kaplay logo

Layer

Miscalenous