> For the complete documentation index, see [llms.txt](https://liquiidio.gitbook.io/unity-plugin-suite/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liquiidio.gitbook.io/unity-plugin-suite/wcwunity/installation/webgl_installation.md).

# WebGL Installation

WebGL builds will require the index.html file to be customised.

Download the full customised file [here](https://github.com/liquiidio/UnityPluginSuiteGitbook/blob/WcwUnity/custom/downloads/index.html).

**Important!** waxjs.js needs to be included in your build, next to the customised html file and needs to be loaded by your html file. Download waxjs.js [here](https://github.com/worldwide-asset-exchange/waxjs/tree/develop/dist-web)

> **Ensure that this line is added to make websockets work.**

```js
window.unityInstance = unityInstance;
```

<details>

<summary>Further reading</summary>

WebAssembly for [security](https://webassembly.org/docs/security/) purposes does not have Networking-Capabilities.

Read more here: (<https://webassembly.org/docs/security/>)

</details>

#### Final script should have this included

```js
      script.onload = () => {
        createUnityInstance(canvas, config, (progress) => {
          progressBarFull.style.width = 100 * progress + "%";
          }).then((unityInstance) => {
	  
	  // !!! IMPORTANT
	  window.unityInstance = unityInstance; // <-- THIS LINE MUST BE ADDED TO ENSURE WEBSOCKETS WORK!!!
          // !!! IMPORTANT
	  
          loadingBar.style.display = "none";
          fullscreenButton.onclick = () => {
          unityInstance.SetFullscreen(1);
          };
        }).catch((message) => {
          alert(message);
        });
```

#### Additional snippets

Unity WebGL requires an event listener to paste from the OS clipboard. Use the following structure in `script.onload`.

```js
	// !!!
	// !!! adding this Listener allows to copy-paste date from outside the WebGL-Build into the WebGL-Build
        window.addEventListener('paste', function (e) {
		const str = e.clipboardData.getData('text');
		// Calls Method OnBrowserClipboardPaste in class WaxCloudWalletMainPanel while passing str as argument
           	window.unityInstance.SendMessage('WaxCloudWalletMainPanel', 'OnBrowserClipboardPaste', str);
        });
	// !!!
     });
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liquiidio.gitbook.io/unity-plugin-suite/wcwunity/installation/webgl_installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
