Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Error being thrown out of unity webgl library

Discussion in 'WebGL' started by justin_unity591, Oct 5, 2023.

  1. justin_unity591

    justin_unity591

    Joined:
    Sep 16, 2019
    Posts:
    4
    Our game crashes during the loading process, and throws out the error:
    TypeError: Cannot read properties of undefined (reading 'getSupportedExtensions'),TypeError: Cannot read properties of undefined (reading 'getSupportedExtensions')

    Which traces back to the built framework js file line 4237 specifically this line
    var exts = GLctx.getSupportedExtensions();

    I am assuming this has something to do with our custom template as we are being forced to update from unity 2019 to 2020 due to some security updates we require. I am assuming it might be a simple overlooked change that is causing this but I cant find anyone else who has experienced a similar error and have run out of ideas.
    The script to create our unity instance is as follows(with identifying names removed):
    Code (JavaScript):
    1. var gameInstance;
    2.        
    3.         var canvas = document.querySelector("#game-container");
    4.         var buildUrl = "Build";
    5.         var loaderUrl = buildUrl + "/54b0a94d1fe59067ab630f467a377b39.js";
    6.         var config = {
    7.             dataUrl: buildUrl + "/a866f82a6d184e9ac09252c3939b9824.data",
    8.             frameworkUrl: buildUrl + "/0a5162914a20d5855de16b7fe70537e0.js",
    9.             codeUrl: buildUrl + "/80aff3f7d0250e8d55c1beddb7528e82.wasm",
    10.             streamingAssetsUrl: "StreamingAssets",
    11.             companyName: "",
    12.             productName: "",
    13.             productVersion: ""
    14.         };
    15.        
    16.         var script = document.createElement("script");
    17.         script.src = loaderUrl;
    18.         script.onload = () => {
    19.             if (Modernizr.webgl) {
    20.                 $('#no-support').hide();
    21.                 $('#game-wrapper').show();
    22.                 createUnityInstance(canvas, config, (progress) => {
    23.                     })
    24.                     .then((unityInstance) => {
    25.                     }).catch((message) => {
    26.                         alert(message);
    27.                     });
    28.             } else {
    29.                 $('#no-support').show();
    30.                 $('#game-wrapper').hide();
    31.             }
    32.         //});
    33.         };
    34.         document.body.appendChild(script);
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    I vaguely recall a (Safari?) browser issue that gave such an error, that we worked around into Emscripten compiler. Which browser version and Unity version are you on? Other browsers give the problem?

    What is happening there is that GLctx is supposed to be the initialized WebGL context, that is created at startup. But it looks like the code is unable to initialize it properly. However there should be a readable error message when WebGL initialization doesn't work, which is why I recall there being a browser issue with this (context creation would work, but then not really work, or something like that)
     
  3. justin_unity591

    justin_unity591

    Joined:
    Sep 16, 2019
    Posts:
    4
    Our unity version is 2020.3.41f`, I am testing mainly in chrome but have also tried firefox with the same result. I even had a coworker test on their machine as well and they had the same error so I think its safe to rule out the browser or system based issues.