Hello friends so I have built a simple preloader for my assets using a global var loaderGL = 0;
and then when a model is loaded and textures etc I do this:
if (child1.isMesh) {
roughnessMipmapper.generateMipmaps(child1.material);
loaderGL++;
}
if (child2.isMesh) {
roughnessMipmapper.generateMipmaps(child2.material);
loaderGL++;
}
Now the loaderGL count for me ends on 31 so everything is loaded when it hits 31
and then I do this to remove the preloader:
function animate() {
if (loaderGL === 31) {
loaderGL='loaded';
console.log('Assets Loader:',loaderGL);
$(".loading-screen").fadeOut(2500);
$(".logo-load").fadeTo(200, 0.0);
$(".experience-div").fadeIn(2500);
$("#start").css("opacity", "1.00");
$("#start").addClass("intro-open");
$("#start").addClass("opacity-open");
$("#start").css("opacity", "1.00");
$(".start .intro-open").removeClass("intro-close");
$(".start .page-full").css("pointer-events", "auto");
setTimeout(function () {
$(".start .page-wrapper-para").addClass("opacity-open");
}, 1000);
setTimeout(function () {
$(".start .page-wrapper-title").addClass("opacity-open");
}, 1250);
setTimeout(function () {
$(".start .page-wrapper-ts").addClass("opacity-open");
}, 1500);
setTimeout(function () {
$(".start .buttn").addClass("opacity-open");
}, 1750);
}
}
Now apparently when I have shown a few people this project online the preloader doesn’t get removed so I am wondering if the count of 31 is wrong?? or is it another issue?
Here is the full UNFINISHED project so you can have a look at the preloader:
https://ui-unicorn.co.uk/game-lesson-1/preload
thank you for reading