WAX Unity Web3 Suite
AtomicAssets
AtomicAssets
  • Getting Started
  • Installation
    • WebGL Installation
  • Examples
    • Unity Example
    • Filtered assets avilable for trading
    • AccountExample
    • BurnsExample
    • CollectionsExample
    • OffersExample
    • SchemasExample
    • TemplatesExample
    • TransfersExample
  • API Docs
    • AtomicAssetsApiFactory
    • Accounts
      • AccountsApi
        • AccountCollectionDto
          • DataDto
            • SchemasDto
            • TemplatesDto
        • AccountDto
          • DataDto
            • CollectionsDto
            • TemplatesDto
        • AccountsDto
          • DataDto
      • AccountsUriParameterBuilder
    • Assets
      • AssetsApi
        • AssetDto
          • DataDto
            • BackedTokensDto
            • CollectionDto
            • FormatDto
            • SchemaDto
            • ImmutableDataDto
            • TemplateDto
        • AssetsDto
          • DataDto
            • BackedTokensDto
            • CollectionDto
            • SchemaDto
              • FormatDto
            • TemplateDto
              • ImmutableDataDto
      • AssetsUriParameterBuilder
    • Burns
      • BurnsApi
        • BurnDto
          • DataDto
            • CollectionsDto
            • TemplatesDto
        • BurnsDto
          • DataDto
      • BurnsUriParameterBuilder
    • Collections
      • CollectionsApi
        • CollectionDto
          • DataDto
        • CollectionsDto
          • DataDto
      • CollectionsUriParameterBuilder
    • Config
      • ConfigApi
        • ConfigDto
    • Offers
      • OffersApi
        • OfferDto
          • DataDto
            • AssetDto
              • BackedTokensDto
              • CollectionDto
              • SchemaDto
                • FormatDto
              • TemplateDto
                • ImmutableDataDto
        • OffersDto
          • DataDto
            • AssetDto
              • BackedTokensDto
              • CollectionDto
              • SchemaDto
                • FormatDto
              • TemplateDto
                • ImmutableDataDto
      • OffersUriParameterBuilder
    • Schemas
      • SchemasApi
        • SchemaDto
          • DataDto
            • CollectionDto
            • FormatDto
        • SchemasDto
          • DataDto
            • CollectionDto
            • FormatDto
      • SchemasUriParameterBuilder
    • Templates
      • TemplatesApi
        • TemplateDto
          • DataDto
            • CollectionDto
            • SchemaDto
              • FormatDto
        • TemplatesDto
          • DataDto
            • CollectionDto
            • SchemaDto
              • FormatDto
      • TemplatesUriParameterBuilder
    • Transfers
      • TransfersApi
        • TransfersDto
          • DataDto
            • AssetDto
              • BackedTokensDto
              • CollectionDto
              • SchemaDto
                • FormatDto
              • TemplateDto
                • ImmutableDataDto
      • TransfersUriParameterBuilder
    • StatsDto
      • DataDto
    • LogsDto
      • DataDto
    • Core
      • HttpRequestBuilder
      • HttpResponseMessageExtension
Powered by GitBook
On this page
Edit on GitHub
  1. Installation

WebGL Installation

PreviousInstallationNextExamples

Last updated 2 years ago

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

Download the full customised file .

Ensure that this line is added to make websockets work.

window.unityInstance = unityInstance;
Further reading

WebAssembly for purposes does not have Networking-Capabilities.

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

Final script should have this included

      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.

window.addEventListener('paste', function (e) {
      const str = e.clipboardData.getData('text');
      window.unityInstance.SendMessage('CanvasExample', 'OnBrowserClipboardPaste', str);
     });
here
security
Page cover image