Playable Ads
Luna Engine
PlayWorks
Unity WebGL
AppLovin
Unity Ads
Mobile Game Development

Building Sub-5MB Unity Playable Ads: Luna Engine & PlayWorks Integration Guide

5 min read
Eshan Naithani

Playable Ads are the highest-converting performance marketing format for mobile games. By allowing prospective players to sample 15 to 30 seconds of interactive gameplay directly inside another app, conversion rates (Install-to-Click) skyrocket compared to static video ads.

However, advertising networks (AppLovin, Unity Ads, ironSource, Mintegral, and Google Ads) enforce brutal technical submission rules:

  1. Single-File Bundle Constraint: The entire playable ad—code, HTML, CSS, textures, audio, and shaders—must be packaged into a single self-contained .html file.
  2. Strict Size Ceiling: Total uncompressed bundle size must be sub-5MB (and under 2MB for ultra-fast ad server networks).
  3. Zero External HTTP Requests: External CDN calls, asset streaming, or dynamic script tags are strictly prohibited.

Standard Unity WebGL exports fail these constraints because the default Wasm runtime engine alone exceeds 10MB+.

In this guide, we cover how to build sub-5MB Unity Playable Ads using Luna Engine (formerly Luna Labs / PlayWorks).


1. Why Standard Unity WebGL Fails Playable Ad Rules

Technical RequirementStandard Unity WebGL ExportPlayable Ad Rule RequirementLuna Engine / PlayWorks Solution
Output FormatMulti-file directory (.wasm, .data, .js)Single .html fileInlines all scripts, HTML, and Base64 assets into one .html file.
Code Runtime Size10MB – 25MB (Engine Wasm)Sub-2MB total footprintTranspiles C# code directly into lightweight native JavaScript / HTML5 Canvas.
External RequestsAllowed (CDN / Addressables)STRICTLY PROHIBITED (0 HTTP requests)Inlines all audio and textures as Base64 data URIs.

2. How Luna Engine (PlayWorks) Works in Unity

Luna Engine is an enterprise tool built specifically for Unity game developers to export lightweight HTML5 playable ads directly from their existing Unity projects.

Code
 [Unity C# Code & Scene Assets]
              │
              ▼ (Luna AST Transpiler)
 [C# Transpiled to Native JS]  +  [Base64 Encoded Sprites/Audio]
              │
              ▼ (Luna Packaging Engine)
 ┌────────────────────────────────────────────────────────┐
 │            SINGLE PLAYABLE AD BUNDLE (.html)           │
 │  ├── Lightweight HTML5 Canvas Engine (<1.5MB)          │
 │  ├── Transpiled C# Gameplay Logic                      │
 │  └── Embedded Base64 Textures & MRAID Ad Hooks         │
 └────────────────────────────────────────────────────────┘

3. Step-by-Step Optimization for Sub-5MB Playable Ads

A. Isolate Core Gameplay Mechanics

Do not export your full mobile game scene to Luna. Create a dedicated Playable Ad Scene containing only:

  • 1 core gameplay mechanic (e.g., sorting 3 birds, tapping 1 puzzle combination, or 1 short tycoon upgrade loop).
  • 1 clear Call-To-Action (CTA) screen ("Install Now on App Store / Google Play").
  • Lightweight 2D UI sprites or low-poly 3D models (under 5,000 total polygons).

B. Texture & Audio Base64 Optimization

Because all assets must be embedded as Base64 strings in a single HTML file:

  • Texture Atlasing: Packing all UI buttons, characters, and backgrounds into a single 1024x1024 sprite sheet.
  • Audio Compression: Include maximum 1 to 2 short sound effects (e.g., success chime + tap sound) compressed as Mono 22kHz MP3 / AAC.

4. Production C# Code: MRAID & Luna Ad Lifecycle Hooks

Playable Ads must report game lifecycle events (Game Started, Install Button Clicked, Game Ended) to ad network SDKs (AppLovin, ironSource) via MRAID (Mobile Rich Media Ad Interface Definitions).

CSHARP
using UnityEngine;
#if LUNA_ENGINE
using Luna.Unity;
#endif

/// <summary>
/// Production C# Controller for handling Playable Ad lifecycles with Luna Engine / PlayWorks.
/// </summary>
public class PlayableAdLifecycleManager : MonoBehaviour
{
    [Header("UI Canvas Elements")]
    [SerializeField] private GameObject endScreenCTA;

    private bool isGameEnded = false;

    private void Start()
    {
        Debug.Log("[Playable Ad] Game Started.");
#if LUNA_ENGINE
        // Notify ad network that playable experience has loaded
        LifeCycle.OnLoaded();
#endif
    }

    public void OnPlayerCompletedLevel()
    {
        if (isGameEnded) return;
        isGameEnded = true;

        Debug.Log("[Playable Ad] Player completed level! Showing CTA...");
        if (endScreenCTA != null) endScreenCTA.SetActive(true);

#if LUNA_ENGINE
        // Trigger end card event to ad network
        LifeCycle.GameEnded();
#endif
    }

    /// <summary>
    /// Called when the player clicks the "Install Now" or "Play Full Game" button.
    /// Redirects the user to the App Store or Google Play Store.
    /// </summary>
    public void OnInstallButtonClicked()
    {
        Debug.Log("[Playable Ad] Install Button Clicked -> Redirecting to App Store!");

#if LUNA_ENGINE
        // Luna Engine automatically resolves the correct store link based on the user's OS
        Playable.InstallFullGame();
#else
        // Fallback for testing in Unity Editor
        Application.OpenURL("https://apps.apple.com/us/developer/eshan-naithani/id1814316548");
#endif
    }
}

5. Ad Network Export & Compliance Testing

Before launching your Playable Ad campaign, test your single HTML bundle against network validators:

  1. AppLovin Validator: Test single .html size constraint (< 5MB). Confirm store redirect fires on Playable.InstallFullGame().
  2. Unity Ads & ironSource: Confirm zero external network calls exist in the HTML bundle.
  3. Mintegral & Google HTML5 Validator: Verify responsive canvas resizing across portrait and landscape mobile screens.

💡 Need a Custom Sub-5MB Playable Ad for Your Game?

Looking to boost User Acquisition (UA) and lower your Cost Per Install (CPI) on AppLovin, Unity Ads, or ironSource? I build high-converting, sub-5MB Unity Playable Ads using Luna Engine:

  • Playable Ad Development: Converting core Unity game mechanics into lightweight sub-5MB single-file HTML ads.
  • Luna Engine / PlayWorks Integration: Setting up AST code transpilation and MRAID lifecycle hooks.
  • CPI Optimization: Designing high-converting 15-second interaction funnels.

👉 Book a Playable Ad Development Session or reach out directly to discuss your game's user acquisition goals.


🎮 Shipped Projects & Official Store Profiles

Explore live commercial titles and technical systems built with Unity across official stores:


Planning a WebGL or Playable Ad campaign? Explore our WebGL Game Development Services or check out our 2026 Mobile Game Development Cost Guide.

Share this article

Looking to build a production-ready game?

See how I built Bird Sort Mania in 20 days using AI, or check out my full Mobile Games Portfolio to see my shipped titles on Android and iOS.

Join 5,000+ Game Developers

Get weekly insights on Unity performance optimization, AI gameplay architectures, and robust system design. No spam, just deep technical breakdowns.

Unsubscribe at any time. Your data is never shared.

Recommended Reading

More articles in Playable Ads