How best to handle preloader errors?

Hi all,

Wondering how people generally handle errors during preloader? E.g. an asset not loading halts the preloader due to connectivity errors when playing on 3G/4G.

Have looked through the PC preloader source and can’t see any events for errors - happy to add a Pull Request for the future, but wondered if there was an elegant way of handling preloader error/freezes as it stands?

Thanks in advance,
Nate.

1 Like

Hi

I did notice this recently. The code in onAssetLoad and onAssetError is the same,. I wonder if the error event is not fired?

We do have a ‘retry’ mechanism where if an error occurs, it attempts to retry:

However, that depends on an error being thrown. The engine doesn’t yet handle timeouts or connections that are active but no actual network transfer is taking place.

There’s a feature request for this here: https://github.com/playcanvas/engine/issues/2021 It’s tricky as not all asset loads are via XHR (eg images for textures)

1 Like