webgl 整数 或者浮点数越界问题
float unrepresentable in integer range,RuntimeError: float unrepresentable in integer range
webgl解决方案:
https://emscripten.org/docs/compiling/WebAssembly.html#trap-mode
webGLEmscriptenArgs: -s “BINARYEN_TRAP_MODE=‘clamp’”
在unity 中解决方案:
参考:
https://forum.unity.com/threads/how-to-debug-webgl-builds.615094/
编译之前运行一下这个代码:
[MenuItem(“Custom/CompilationWebGL”)]
static public void AddWebGL()
{
PlayerSettings.WebGL.emscriptenArgs = “-s “BINARYEN_TRAP_MODE=‘clamp’””;
}
本文探讨了在WebGL开发中遇到的浮点数无法表示为整数范围的问题,介绍了如何通过Emscripten的-trap-mode参数设置为'clamp'来避免错误,并在Unity中提供了解决方案,包括使用编译前的代码片段来确保兼容性。
8210

被折叠的 条评论
为什么被折叠?



