Unity 2021.2.8 上的 WebGL 构建中出现断言错误
我尝试将项目从 Unity 2019.4.31 升级到 2021.2.8 后,WebGL 构建失败。
起初我使用了旧的 WebGL 模板,然后我使用默认的 Unity 模板进行了测试,但错误保持不变。 clean build.Restarted Unity并搜索了一段时间,但我没有得到任何结果。错误如下,出现在 4-5 个文件中。
构建 C:...\webgl-test\TemplateData\style.css 失败,输出:assert.js:385 throw err; ^
AssertionError [ERR_ASSERTION]:无效的预处理器参数:对象处的 TOTAL_MEMORY=-2147483648。 (C:\Program Files\Unity\Hub\Editor\2021.2.8f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Preprocess.js:18:12) 在 Module._compile (internal/modules/cjs/loader.js: 1138:30) 在 Object.Module._extensions..js (内部/模块/cjs/loader.js:1158:10)在Module.load(内部/模块/cjs/loader.js:986:32)在Function.Module._load(内部/模块/cjs/loader.js) :879:14) 在 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)内部/main/run_main_module.js:17:47 { generatedMessage: false, 代码: 'ERR_ASSERTION', 实际: false, 预期: true, 运算符: '==' }
After I tried to upgrade the project from Unity 2019.4.31 to 2021.2.8, WebGL fails on build.
At first I used the old WebGL template i had, then i tested with the default Unity template but the errors stay the same.I tried normal & clean build.Restarted Unity and search about it for a while but I didn't come up with any results. The error is the following and occurs with 4-5 files.
Building C:...\webgl-test\TemplateData\style.css failed with output: assert.js:385 throw err; ^
AssertionError [ERR_ASSERTION]: Invalid preprocessor argument: TOTAL_MEMORY=-2147483648 at Object. (C:\Program Files\Unity\Hub\Editor\2021.2.8f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Preprocess.js:18:12) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32) at Function.Module._load (internal/modules/cjs/loader.js:879:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { generatedMessage: false, code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道已经过去两个月了,但我找到了解决方法。不知道为什么它会这样做,但它就是这样。进入 ProjectSettings 文件夹,然后打开 ProjectSettings.asset 文件。将 webGLMemorySize 从 2048 更改为 2032 使其对我有用。不知道为什么会这样做,但我希望它有帮助!
I know its been already 2 months but I found a workaround. No idea why it does that though but here it is. Go into the ProjectSettings folder, and open the ProjectSettings.asset file. Changing the webGLMemorySize from 2048 to 2032 made it work for me. No idea why it does this, but i hope it helps!