Hi im aplying the preload functionality call in inisitialze function to load the cubemap textures but functionality not working.
UiManager.prototype.initialize = function() {
const assets = UiManager.Instance.app.assets.findByTag("cubemap_model");
let count = 0;
for (let i = 0; i < assets.length; i++) {
assets[i].on('load', function () {
count++;
if (count === assets.length) {
UiManager.Instance.app.touch ? (UiManager.Instance.changeMobileScreen(0),CameraMovement.Instance.entity.camera.fov = 89,UiManager.Instance.Screens[13].enabled=false) : (UiManager.Instance.changeScreen(4),CameraMovement.Instance.entity.camera.fov = 59);
}
});
UiManager.Instance.app.assets.load(assets[i]);
}
};
Why can’t you just enable preload on the avif files?
Are there any errors or warnings in the console?
What exactly is not working?
-the texture size is in MB so I reduced it to convert in avif files.
- No there is no errors or warnings in the console.
-assets[i].on(‘load’, function () { this line is not executing to proceed it///
I also applied basis compression to it . Maybe this is the error?
Try other file types or turning off basis compression. There is a warning in the console that says that there was a violation of the load handler taking 872ms. Not sure why that happened but try what I suggested.
I just turned off the Basis compression, and it’s working fine. However, when I launch the project again, the cubemap is already enabled without any preloading.
Sorry, I don’t understand the 2nd statement. Do you mean when you launch it, the cubemap textures are already there?