How to check if a cubetexture has been properly loaded

I managed to load them perfectly using jpg files, now I wanna use webp and keep that jpg just as fallback for Safari and so.

Is there any way to do something like this naive test?

  var textureSource = new BABYLON.CubeTexture(textureFile, scene, extensions, true);
  if( textureSource.textureFormat < 0)
  {                                           
    extensions = null;
    textureSource = new BABYLON.CubeTexture(textureFile, scene, extensions, true);
  }

Thank you in advance.

It can’t work like that as the loading is async :slight_smile:

What you can do is use the onError parameter of the CubeTexture to be called if an error is raised

Unfortunatly it raises an “Non specified error” (or something like that since I get it in Spanish) in Microsoft Edge [babylon.js (15,1308785)]

Minimum reproducible example: https://www.babylonjs-playground.com/#T97ARW#1

Thank you!

Nevermind! It seems to be the combination of Edge and Remote Desktop.

2 Likes