Rufus31415 / Simple-WebXR-Unity

⭐ Bringing WebXR to Unity 3D ! B-)
https://rufus31415.github.io/webxr/MRTK-HandInteraction/
MIT License
576 stars 82 forks source link

Fails to compile in Unity 2021.3.3 #51

Open pajama opened 2 years ago

pajama commented 2 years ago

Really cryptic error from unity.

Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\tools\acorn-optimizer.js:1845
  throw err;
  ^

SyntaxError: Unexpected token (4460:62)
  var textEncoder={encoding:"utf-8",encode:encode(input = '') {
                                                              ^

    at Parser.pp$4.raise (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2927:15)
    at Parser.pp.unexpected (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:698:10)
    at Parser.pp.expect (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:692:28)
    at Parser.pp$3.parseObj (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2563:14)
    at Parser.pp$3.parseExprAtom (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2302:19)
    at Parser.pp$3.parseExprSubscripts (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2129:21)
    at Parser.pp$3.parseMaybeUnary (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2106:19)
    at Parser.pp$3.parseExprOps (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2041:21)
    at Parser.pp$3.parseMaybeConditional (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:2024:21)
    at Parser.pp$3.parseMaybeAssign (C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\node_modules\acorn\dist\acorn.js:1997:21) {
  pos: 166718,
  loc: Position { line: 4460, column: 62 },
  raisedAt: 166719
}
emcc2: error: '"C:/Program Files/Unity/Hub/Editor/2021.3.3f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/node/node.exe" "C:\Program Files\Unity\Hub\Editor\2021.3.3f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\tools\acorn-optimizer.js" C:\Users\KEVINA~1\AppData\Local\Temp\emscripten_temp_gz1uwi0k\build.js.pp.js AJSDCE minifyWhitespace' failed (1)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I found a related thread, where the issue was happening in another javascript plugin, but the solution seems unrelated. https://github.com/endel/NativeWebSocket/issues/53

Rufus31415 commented 2 years ago

For the related issue you mentioned, they replaces Pointer_stringify by UTF8ToString Could you try ?

https://github.com/endel/NativeWebSocket/pull/54/commits/baf06b54dba0ee05a1250afefd1b404316ccf3d4

pajama commented 2 years ago

Ah shoot! Thought I had searched for that method. Looks like I missed it in the examples folder. I can give this a shot in a bit.

pajama commented 2 years ago

Replacing those methods results in the same errors. However, removing the SpectatorView samples folders resolves it

Rufus31415 commented 2 years ago

Damn, that's why this is related to your WebSockets thread: SpectatorView uses a web socket.