[SOLVED] Moralis React Webgl

i have a simple unity project which uses authentication kit app runs fine when in build & run in unity with webgl. meta mask connects i can communicate with my smartcontrat all the moralis native api’s work too.

So, when i try to embed the Build with react webgl. the Moralis doesn’t. Am i doing anything wrong here


Do you mean react-unity-webgl? That is a general error, what does your code look like? Check if the error is due to any Moralis use.

When i Build & run from unity the app works fine.
but when embedding the app with

it doesn’t work… the when i click connect button from authentication kit… it just throws error undeifined connect

this issue from github solve the problem :innocent:

ihad to paste my unityExportedBuildFolder in
and edit the

  <title>React App</title>
    <script src="./unityExportedBuildFolder/web3/lib/web3modal.js"></script>
    <script src="./unityExportedBuildFolder/web3/lib/web3.min.js"></script>
    <script src="./unityExportedBuildFolder/web3/index.js"></script>
      var container = document.querySelector("#unity-container");
      var canvas = document.querySelector("#unity-canvas");
      var loadingBar = document.querySelector("#unity-loading-bar");
      var progressBarFull = document.querySelector("#unity-progress-bar-full");
      var fullscreenButton = document.querySelector("#unity-fullscreen-button");
      var warningBanner = document.querySelector("#unity-warning");

      // Shows a temporary message banner/ribbon for a few seconds, or
      // a permanent error message on top of the canvas if type=='error'.
      // If type=='warning', a yellow highlight color is used.
      // Modify or remove this function to customize the visually presented
      // way that non-critical warnings and error messages are presented to the
      // user.
      function unityShowBanner(msg, type) {
        function updateBannerVisibility() {
          warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
        var div = document.createElement('div');
        div.innerHTML = msg;
        if (type == 'error') div.style = 'background: red; padding: 10px;';
        else {
          if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
          setTimeout(function() {
          }, 5000);

      var buildUrl = "Build";
      var loaderUrl = buildUrl + "/contract.loader.js";
      var config = {
        dataUrl: buildUrl + "/contract.data",
        frameworkUrl: buildUrl + "/contract.framework.js",
        codeUrl: buildUrl + "/contract.wasm",
        streamingAssetsUrl: "StreamingAssets",
        companyName: "DefaultCompany",
        productName: "test",
        productVersion: "0.1",
        showBanner: unityShowBanner,

      // By default Unity keeps WebGL canvas render target size matched with
      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
      // Set this to false if you want to decouple this synchronization from
      // happening inside the engine, and you would instead like to size up
      // the canvas DOM size and WebGL render target sizes yourself.
      // config.matchWebGLToCanvasSize = false;

      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
        container.className = "unity-mobile";
        // Avoid draining fillrate performance on mobile devices,
        // and default/override low DPI mode on mobile browsers.
        config.devicePixelRatio = 1;
        unityShowBanner('WebGL builds are not supported on mobile devices.');
      } else {
        canvas.style.width = "960px";
        canvas.style.height = "600px";
      loadingBar.style.display = "block";

      var script = document.createElement("script");
      script.src = loaderUrl;
      script.onload = () => {
        createUnityInstance(canvas, config, (progress) => {
          progressBarFull.style.width = 100 * progress + "%";
        }).then((unityInstance) => {
          loadingBar.style.display = "none";
          fullscreenButton.onclick = () => {
        }).catch((message) => {
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
1 Like