How to get rid of WebGL preloader in Unity 5.6
Hello,
Looks like in Unity 5.6, WebGL template system has been changed and the documentation (https://docs.unity3d.com/Manual/webgl-templates.html) is outdated.
For example, both new Minimal and Default templates don't have neither "%UNITY_WEBGL_LOADER_GLUE%", nor "canvas" element.
I want to implement a preloader without progress bar (constant animation) and remove it when the Unity content is loaded. My application runs with 100% width and 100% height of user screen.
So how can I get rid of the black rectangle with standard preloader and just receive an event when it's time to hide my custom HTML5 preloader?
Answer by Matsuguma · Sep 01, 2017 at 08:23 AM
I was able to remove the initial logo and loading bar on 5.6 I tried a lot of things with the UnityProgress.js, but what really did the job was commenting out one line from UnityLoader.js:
e.logo || (e.logo = document.createElement("div"), e.logo.style.cssText = a + "background: url('" + n + "') no-repeat center / contain; width: 154px; height: 130px;", e.container.appendChild(e.logo)), e.progress || (e.progress = document.createElement("div"), e.progress.style.cssText = a + " height: 18px; width: 141px; margin-top: 90px;", e.progress.empty = document.createElement("div"), e.progress.empty.style.cssText = "background: url('" + o + "') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;", e.progress.appendChild(e.progress.empty), e.progress.full = document.createElement("div"), e.progress.full.style.cssText = "background: url('" + i + "') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;", e.progress.appendChild(e.progress.full), e.container.appendChild(e.progress)), e.progress.full.style.width = 100 * t + "%", e.progress.empty.style.width = 100 * (1 - t) + "%", 1 == t && (e.logo.style.display = e.progress.style.display = "none")
This is line 702 of the beautified UnityLoader.js. With this, the loader will not appear.
This still works, but for me it was line 1871. I just searched for "e.logo" and it was the first line where it came up.
Your answer
![](https://koobas.hobune.stream/wayback/20220612120917im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can WebGL Templates be dynamically modified via scripting? 0 Answers
What are Unity's default emscripten arguments during build? 0 Answers
Help - Export to WebGL 0 Answers
Unity WebGL hosted in .NET Core not connecting to Redis 0 Answers
Unity Project Build using WebGL..Error,WebGL Build Error 0 Answers