<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: LUMENFORM</title>
    <description>The latest articles on DEV Community by LUMENFORM (@lumenform).</description>
    <link>https://dev.to/lumenform</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4161228%2Fc934ae4b-c1a1-4f0f-a77c-0bfd94cebf3f.png</url>
      <title>DEV Community: LUMENFORM</title>
      <link>https://dev.to/lumenform</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lumenform"/>
    <language>en</language>
    <item>
      <title>Shipping single-file HTML5 playable ads: my Unity 2022 WebGL pipeline</title>
      <dc:creator>LUMENFORM</dc:creator>
      <pubDate>Sun, 04 Oct 2026 08:49:41 +0000</pubDate>
      <link>https://dev.to/lumenform/shipping-single-file-html5-playable-ads-my-unity-2022-webgl-pipeline-57pb</link>
      <guid>https://dev.to/lumenform/shipping-single-file-html5-playable-ads-my-unity-2022-webgl-pipeline-57pb</guid>
      <description>&lt;p&gt;Last month I set out to answer a simple question: how small and how self-contained can a Unity WebGL playable ad actually be?&lt;/p&gt;

&lt;p&gt;Three builds later, here's what I ended up with — all playable directly in the browser:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Match-3 playable&lt;/strong&gt; (Prism Vein) — chain reactions, three special-match effects, audio end card. 4.7 MiB (EN) / 5.1 MiB (ZH)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idle-growth playable&lt;/strong&gt; (Core Forge) — tap-collect, three upgrade tiers, 1,000-unit milestone. ~8.2 MiB with a runtime EN/ZH switch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3D product microsite&lt;/strong&gt; (Atlas Relay) — orbit camera, three hotspot panels, day/night toggle. 9.61 MiB&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Playable here: &lt;a href="https://www.lumenformlab.com" rel="noopener noreferrer"&gt;https://www.lumenformlab.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The constraints that shaped everything
&lt;/h2&gt;

&lt;p&gt;Playable ads live inside ad network SDKs (MRAID containers), and networks impose caps: file size, single-file delivery, no external requests, muted audio until first interaction, and a CTA that fires &lt;code&gt;mraid.open()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That rules out the default Unity WebGL export. The pipeline became: &lt;strong&gt;Unity 2022 → WebGL export → repack&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Export settings that matter
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Brotli/gzip compression on the build payload&lt;/li&gt;
&lt;li&gt;Strip engine code, high managed stripping level&lt;/li&gt;
&lt;li&gt;No exceptions, no stack traces (smaller + faster startup)&lt;/li&gt;
&lt;li&gt;IL2CPP + code stripping&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Repack to a single file
&lt;/h3&gt;

&lt;p&gt;The default export ships as &lt;code&gt;index.html + Build/*.unityweb + TemplateData/*&lt;/code&gt;. For playable delivery this gets repacked into &lt;strong&gt;one inlined index.html&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;base64-inline the &lt;code&gt;.wasm&lt;/code&gt;, &lt;code&gt;.data&lt;/code&gt;, &lt;code&gt;.framework.js&lt;/code&gt; payloads&lt;/li&gt;
&lt;li&gt;inline the loader&lt;/li&gt;
&lt;li&gt;zero external requests — verifiable in DevTools: the network tab shows exactly one document request&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Audio discipline
&lt;/h3&gt;

&lt;p&gt;Network rules require muted audio until first tap. I keep an &lt;code&gt;AudioContext&lt;/code&gt; suspended until the first pointer event, then resume it — sounds only fire after real interaction.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. CTA through MRAID
&lt;/h3&gt;

&lt;p&gt;The end-card CTA checks for &lt;code&gt;mraid&lt;/code&gt; availability:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inside an MRAID container → &lt;code&gt;mraid.open(url)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;outside (plain web demo) → &lt;code&gt;window.open(url)&lt;/code&gt; fallback&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wrapped the match-3 build in a MRAID 2.0 harness locally (&lt;code&gt;getVersion()&lt;/code&gt; returns 2.0) to verify the bridge works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Size results
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Build&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Languages&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Match-3&lt;/td&gt;
&lt;td&gt;4.7 MiB&lt;/td&gt;
&lt;td&gt;EN / ZH (two separate builds)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Idle-growth&lt;/td&gt;
&lt;td&gt;~8.2 MiB&lt;/td&gt;
&lt;td&gt;EN+ZH runtime switch in one build&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3D microsite&lt;/td&gt;
&lt;td&gt;9.61 MiB (18 files)&lt;/td&gt;
&lt;td&gt;EN+ZH&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most of the match-3 savings came from texture discipline (palette-swapped sprites) and audio compression, not from hacking the engine.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell anyone building playables
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Budget the size cap first, design second&lt;/li&gt;
&lt;li&gt;Test inside a real MRAID harness, not just a browser tab&lt;/li&gt;
&lt;li&gt;Keep one inlined file as the single source of truth for delivery&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm a solo developer building these end-to-end (Unity 2022 → WebGL → repack), currently taking on small fixed-scope builds. If you work with playable ads or interactive 3D, I'm happy to compare notes — all three demos are live at &lt;a href="https://www.lumenformlab.com" rel="noopener noreferrer"&gt;https://www.lumenformlab.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>unity3d</category>
      <category>webgl</category>
      <category>html</category>
    </item>
  </channel>
</rss>
