Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Marrt

8
Posts
7
Following
A member registered Aug 25, 2024 · View creator page →

Recent community posts

(1 edit)

Found another issue which i asked ChatGPT about with this prompt:

"I got a webgl unity build with a loading bar. It works the first time, but when I update my build and the cache needs to refresh the loading bar stays at 100% throughout the new download"

and it gave me this suggestion, can you make sense of it and if it is worth of an update if you can reproduce:

<script>

  const buildUrl = "Build";

  const loaderUrl = buildUrl + "/yourproject.loader.js";

  const config = {

    dataUrl: buildUrl + "/yourproject.data",

    frameworkUrl: buildUrl + "/yourproject.framework.js",

    codeUrl: buildUrl + "/yourproject.wasm",

    streamingAssetsUrl: "StreamingAssets",

    companyName: "YourCompany",

    productName: "YourProduct",

    productVersion: "1.0",

  };

  const loadingBar = document.getElementById("loadingBar");

  const progressBarFull = document.getElementById("progressBarFull");

  const updateProgress = (progress) => {

    progressBarFull.style.width = `${100 * progress}%`;

  };

  const script = document.createElement("script");

  script.src = loaderUrl;

  script.onload = () => {

    createUnityInstance(document.querySelector("#unity-canvas"), config, (progress) => {

      updateProgress(progress);

    }).then((unityInstance) => {

      loadingBar.style.display = "none";

    }).catch((message) => {

      alert(message);

    });

  };

  document.body.appendChild(script);

</script>

Key Points:

  • The progress callback inside createUnityInstance() doesn’t always track actual download progress after cache updates unless you handle it explicitly.

  • The Unity loader might say "100%" because it thinks it's loading from cache, but the browser is still re-downloading the new files.

__________

Apart from that, i am also checking out renderResolution control in WebGL for improving performance. That would also be a worthy addition

New Solution
https://discussions.unity.com/t/how-does-saving-work-in-webgl/619521/13

(3 edits)

Awesome stuff!
Also, i would consider adding this (new?) feature for saving PlayerPrefs and files:

Add "autoSyncPersistentDataPath: true" to the config={}
https://docs.unity3d.com/Manual/web-templates-build-configuration.html

Also, adding '-webkit-user-select: none; user-select: none;' to 'div#gameContainer canvas' is advised https://discussions.unity.com/t/odd-issue-with-focus-in-firefox/1651226/2 

When editing the game page in intich.io, switch to the details section of your game description and toggle HTML view on the top right and try this code

<div style="padding: 10px;background-color: #e4eaef;border-radius: 2px;">
  <style>
    summary { list-style-type: ' 👁️ '; }
    details[open] > summary { list-style-type: ' 🧿 '; }
  </style>
  <details>
    <summary><strong><u>Header1</u></strong></summary>
<p>Text1</p>
  </details>
  <br>
  <details>
    <summary>Header2</summary>
    <p>Text2</p>
  </details>
</div>

More info on summery tags:

https://www.w3schools.com/tags/tag_summary.asp