最近做了一个项目,要求unity打包出webgl,并在手机上运行(iOS,安卓),发现在测试中会出现一个弹框的问题(如图);
查找一番后发现:
这个问题其实是在你unity打出webgl工程后 Build/UnityLoader.js 中,一般打开后没有格式,建议格式化后查看更方便直观(在线格式化,度娘就能轻松找到一堆,这里就不说出来了,当然你想要也可以私信我推荐你我用的);
找到下面这段代码:(建议直接ctrl+f查找t(),或者查找 Blobs: {},)
compatibilityCheck: function(e, t, r) {
UnityLoader.SystemInfo.hasWebGL ? UnityLoader.SystemInfo.mobile ? e.popup("Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway.", [{
text: "OK",
callback: t
}]) : ["Edge", "Firefox", "Chrome", "Safari"].indexOf(UnityLoader.SystemInfo.browser) == -1 ? e.popup("Please note that your browser is not