TL;DR: my loading bar on unity webGL player is crap
i choose this tutorial (out of others):
https://ocias.com/blog/unity-webgl-custom-progress-bar/
after updating css i ended up with UnityProgress.js:
function init()
{
}
function UnityProgress(dom)
{
this.progress = 0.0;
this.message = "";
this.dom = dom;
createjs.CSSPlugin.install(createjs.Tween);
createjs.Ticker.setFPS(60);
var parent = dom.parentNode;
this.SetProgress = function (progress)
{
if (this.progress < progress)
{
this.progress = progress;
}
if (progress == 1)
{
this.SetMessage("Preparing...");
document.getElementById("spinner").style.display = "inherit";
document.getElementById("bgBar").style.display = "none";
document.getElementById("progressBar").style.display = "none";
}
this.Update();
}
this.SetMessage = function (message)
{
this.message = message;
this.Update();
}
this.Clear = function ()
{
document.getElementById("loadingBox").style.display = "none";
}
this.Update = function ()
{
var length = 200 * Math.min(this.progress, 1);
bar = document.getElementById("progressBar");
bar.style.width = length + "px";
createjs.Tween.removeTweens(bar);
createjs.Tween.get(bar).to({ width: length }, 500, createjs.Ease.sineOut);
document.getElementById("loadingInfo").innerHTML = this.message;
}
this.Update();
}
the loading bar is still really slow even thought it worked fast for the sites in the tutorial but not for mine here on newgrounds
the demo for seeing the loading bar (if u want):