Unity WebGL RuntimeError: integer overflow(整数溢出问题)

今天在开发Web版项目的时候发现整数溢出的问题。

An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
RuntimeError: integer overflow

仔细查看是WebAssembly在实例化的时候出现了问题。于是我门查看一下打包的设置。

在打包设置里边我门看一下 WebAssembly Arithmetic Exceptions 

包含 WebAssembly 代码的不同捕获模式的枚举。

此枚举在 WebGL 平台中用于定义在 WebAssembly 代码中执行算术运算时使用的捕获类型。

throw WebAssembly 代码会在除以零、将非常大的浮点数舍入为 int 等情况下抛出异常。
ignore 此模式通过在执行算术运算时将浮点值限制在合理范围内来避免陷阱。

设置为 Ignore,忽略掉浏览器的异常错误。

这样子就不会在浏览器端弹出报错弹窗而影响程序运行逻辑。

猜你喜欢

转载自blog.csdn.net/f402455894/article/details/125784400
今日推荐