Function

onLoadError

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

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

param action- The 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}`);
});

returns The event controller.

since v3001.0

group Events

kaplay logo

Layer

Miscalenous