<?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: how my Unity 2022 WebGL pipeline hit 4.7 MiB under ad-network constraints</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? The short answer, after three builds: 4.7 MiB for a match-3 in one file, ~8.2 MiB for an idle-growth game in one file, and a 9.61 MiB 18-file 3D microsite — and the microsite is deliberately not single-file, because it doesn't ship inside an ad network.&lt;/p&gt;

&lt;p&gt;Playable ads live inside ad network SDKs (MRAID containers), and networks impose hard 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;. Those constraints rule out the default Unity WebGL export, which ships as &lt;code&gt;index.html + Build/*.unityweb + TemplateData/*&lt;/code&gt;. My pipeline became: &lt;strong&gt;Unity 2022 → WebGL export → repack&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Export settings that matter
&lt;/h2&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;h2&gt;
  
  
  2. Repack to a single file
&lt;/h2&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 one inlined &lt;code&gt;index.html&lt;/code&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;, and &lt;code&gt;.framework.js&lt;/code&gt; payloads&lt;/li&gt;
&lt;li&gt;inline the loader&lt;/li&gt;
&lt;li&gt;no external requests for the two playable builds; in DevTools, the network panel shows exactly one document request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This applies to the two playable builds (Prism Vein and Core Forge). The 3D microsite (Atlas Relay) stays as 18 files — 9.61 MiB — because it is not a playable ad and does not need the single-file constraint.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Audio discipline
&lt;/h2&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;h2&gt;
  
  
  4. CTA through MRAID
&lt;/h2&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;th&gt;Single file?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Match-3 (Prism Vein)&lt;/td&gt;
&lt;td&gt;4.7 MiB&lt;/td&gt;
&lt;td&gt;EN / ZH (two separate builds)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Idle-growth (Core Forge)&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;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3D microsite (Atlas Relay)&lt;/td&gt;
&lt;td&gt;9.61 MiB (18 files)&lt;/td&gt;
&lt;td&gt;EN+ZH&lt;/td&gt;
&lt;td&gt;No&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 playable delivery — and don't force single-file on things that don't need it&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A question for you
&lt;/h2&gt;

&lt;p&gt;I'm a solo developer building these end-to-end (Unity 2022 → WebGL → repack). What's the smallest single-file Unity WebGL payload you've shipped to an ad network, and how do you handle a cap under 5 MiB? If this helped, leave a reaction or ask below — I'll answer in the comments. 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>playableads</category>
    </item>
  </channel>
</rss>
