当我在网站上运行我的项目的WebGL版本时,会显示:
请注意,Unity WebGL目前不支持移动设备
当我单击确定后,我的游戏仍像往常一样运行,那么为什么它声明不支持移动设备?我可以禁用警报吗?请注意,Unity WebGL目前不支持移动设备
当我单击确定后,我的游戏仍像往常一样运行,那么为什么它声明不支持移动设备?我可以禁用警报吗?它可以运行在您的手机和浏览器上,但是仍然远未得到普遍支持,这就是为什么Unity不鼓励使用它的原因。
至于禁用警告,它是在UnityLoader.js
的开头实现的,您可以轻松地将其删除。
var UnityLoader=UnityLoader||{compatibilityCheck:function(e,t,r){UnityLoader.SystemInfo.hasWebGL?UnityLoader.SystemInfo.mobile?e.popup("请注意,当前移动设备不支持Unity WebGL。如果您希望继续,请按“确定”",[{text:"确定",callback:t}]) (...)
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 函数更改以消除此警告。参考资料