onLoadError(action: (name: string, failedAsset: Asset)=>void): KEventController | undefined

Register an event that runs once for each asset that failed to load, after all others have completed.

paramactionThe function to run when the event is triggered.

// this will not load
loadSprite("bobo", "notavalidURL");

// process the error
// you decide whether to ignore it, or throw an error and halt the game
onLoadError((name, asset) => {
    debug.error(`${name} failed to load: ${asset.error}`);
})

returnsThe event controller.

sincev3001.0

kaplay logo

Misc

Layer