Search Issue Tracker

By Design

Votes

0

Found in

2017.2.0f3

Issue ID

968373

Regression

No

[WebGL] "Uncaught SyntaxError: missing ) after argument list" appear in browser after build

WebGL

-

How to reproduce:
1. Download attached project file and open "Init" Scene
2. Switch Platform to WebGL
3. Press Build & Run

Expected result: Game should work without any javascript errors
Actual result: Built game didn't work, "SyntaxError: missing ) after argument list", "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" error appears in the console.

Reproduced with: 5.6.4p2, 2017.1.2p2, 2017.2.0p2, 2017.3.0b9, 2018.1.0a4

Tested on: Chrome, Firefox, Edge

  1. Resolution Note:

    The canvas object can be accessed in the following ways:
    from html: gameInstance.Module.canvas
    from js plugin: Module.canvas

    however, you can only access the canvas object only once the game instance has been initialized. That can be done on onRuntimeInitialized event, for example:
    var gameInstance = UnityLoader.instantiate("gameContainer", "Build/<buildname>.json", { Module: {
    onRuntimeInitialized: function() {
    var c = this.canvas;
    // do something with c
    }

Comments (2)

  1. sacb0y

    Nov 15, 2018 05:29

    This needs explanation

  2. durp

    Feb 05, 2018 03:39

    This is marked as resolved. Where is the missing )? Could I just insert it into my UnityLoader.js or do I need to get a new version of unity and rebuild?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.