- Home /
Question by
dbillings_thehalseygroupllc · Sep 07, 2016 at 12:16 AM ·
unity 5webglprogress-barprogress barprogressbar
Is it possible to get a smooth WebGL Progress Bar?
Using Unity's default UnityLoader.js and its data is there a way to create a smooth functioning loading progress bar on WebGL projects?
Previously this following code taken from Alex Ocias' blog would result in a smooth bar, however since Unity updated to 5.4 it now no longer functions smoothly and will get stuck or not even begin to move. The same issue occurs with Unity's default WebGL template progress bar.
does anyone know a working solution to achieve a smooth progress bar for WebGL builds that were built in version 5.4 or later?
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")
createjs.Tween.removeTweens(bar);
createjs.Tween.get(bar).to({width: length}, 500, createjs.Ease.sineOut);
document.getElementById("loadingInfo").innerHTML = this.message;
}
this.Update ();
}
Comment