Unity Mobile WebGL兼容性

时间:2017-05-23 22:46:38

标签: unity3d

当我在网站上运行我的项目的WebGL版本时,它会显示:please note that unity webgl is not currently supported on mobiles

当我点击确定时,我的游戏仍然正常运行,为什么它说它不支持手机?我可以禁用警报吗?

3 个答案:

答案 0 :(得分:2)

它在您的手机和您的浏览器上运行,但它仍然远离一般支持,it's why Unity is discouraging this

至于禁用警告,它是在UnityLoader.js的开头实施的,您可以轻松删除它。

var UnityLoader=UnityLoader||{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}]) (...)

答案 1 :(得分:0)

因此Unity WebGL基本上构建了don't work on mobile。但是您可以在此处查看有关如何对其进行测试的文章,以查看您的特定游戏是否有效 https://simmer.io/articles/testing-a-unity-webgl-build-on-mobile

答案 2 :(得分:0)

转到 Build 目录并打开 UnityLoader.js 文件,然后 替换此代码

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 currently supported for this Unity WebGL content. Press OK if you wish to continue anyway.", [{ text: "OK", callback: t }]) : t() : e.popup("Your browser does not support WebGL", [{ text: "OK", callback: r }]) },

compatibilityCheck: function(e, t, r) { t(); },

因此,请更改此 compatibilityCheck 功能以删除此警告。reference