WebGL报错 uncaught referenceerror unitymodule is not defined

本来是好好的,我只是想修改一下UnityProgress.js这个脚本来改一下加载webGl的时候的Unity元素为自定义,或者起码不显示吧。

function UnityProgress(unityInstance, progress) {
if (!unityInstance.Module)
return;
if (!unityInstance.logo) {
unityInstance.logo = document.createElement("div");
unityInstance.logo.className = "logo " + unityInstance.Module.splashScreenStyle;
unityInstance.container.appendChild(unityInstance.logo);
}
if (!unityInstance.progress) {
unityInstance.progress = document.createElement("div");
unityInstance.progress.className = "progress " + unityInstance.Module.splashScreenStyle;
unityInstance.progress.empty = document.createElement("div");
unityInstance.progress.empty.className = "empty";
unityInstance.progress.appendChild(unityInstance.progress.empty);
unityInstance.progress.full = document.createElement("div");
unityInstance.progress.full.className = "full";
unityInstance.progress.appendChild(unityInstance.progress.full);
unityInstance.container.appendChild(unityInstance.progress);
}
unityInstance.progress.full.style.width = (100 * progress) + "%";
unityInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
if (progress == 1)
unityInstance.logo.style.display = unityInstance.progress.style.display = "none";
}

把带logo的段落删掉,结果打开就报这错误。

把原始版本放上,也不行,通过链接访问的所有的webgl都报这个错了。重启电脑,也不行

猜想也许是跟MIME有关,把.unity3d 与.unityweb加入到MIME中,报重复错误,只能删掉,又把MIME服务、所有有关服务都重启然后就自己好了

 

posted @ 2021-08-14 19:09  昭1122  阅读(772)  评论(0编辑  收藏  举报