'AssertionError in WebGL build on Unity 2021.2.8
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: '==' }
Solution 1:[1]
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!
Solution 2:[2]
Is there any compelling reason that you need to use JDeveloper? Otherwise, there are other options such as IntelliJ IDEA (community version) which is great for Java.
Solution 3:[3]
JDK 1.8 has passed a test of time and its very common to use that but jdk 17 is latest version and this version has not passed test of time so its better to use 1.8 or maybe jdk 11 is good too.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AndrewPrevu |
| Solution 2 | biraj silwal |
| Solution 3 | tienph |
