Optimize Startup
Shorten the wait from a player's tap to real gameplay. Keep your initial package small, let the TikTok app download startup packages before the tap, defer setup that isn't essential, and load only the first scene's assets before controls respond.
This guide is part of Optimize Mini Game Performance.

Two milestones define the startup experience. The downloads, initialization, and scene setup behind them often overlap.
- First paint (FP): The first game frame renders on the canvas. Assets or logic might still be loading.
- Time to interactive (TTI): The first playable scene and its input controls respond, so the player can begin real gameplay.
Project type | Target for a first scan (1 MB/s, no cache) | Package size limits (build output) |
Unity | FP within 3 seconds, TTI within 5 seconds | Total package up to 60 MB. All subpackages count toward the total. |
Cocos, JavaScript, and others | FP within 2 seconds, TTI within 4 seconds | Main package up to 4 MB, each independent subpackage up to 4 MB, and total package up to 30 MB. |
Prerequisites
- A mini game that runs in Client preview on a phone
- For TTI reporting in JavaScript: Mini Games SDK 0.26.0 and TikTok 45.4.0 or later
- For startup details on the phone: TikTok 48.1.0 or later on Android
Measure startup and find the bottleneck
Measure a complete launch on a real phone before you change code. Keep the entry type, game version, phone model, network speed, save state, and cache condition the same for runs before and after a change.
- Before release, on Android (TikTok 48.1.0 or later): In Developer options, turn on Show DevInfo Panel, then tap Details next to FP to see Download, Unzip, Source, FP, and TTI times.
- Cache comparison on Android: In Developer options, turn on Disable Client Cache or tap Clear Client Cache to compare a first scan without a cache against a cached revisit. For details, see Debug Your Mini Game.
- On iOS, or on clients without startup details: Record a phone video from the tap to the first accepted input, and add timestamps in your game logs for engine and scene setup. Don't time startup in browser remote debugging.
- Released games: On the Developer Portal, go to Analytics > Performance > Launch. For details, see Mini Games Analytics. Live averages are faster than QR code previews without a cache, because of preloading and cache hits.

Match what you see on the phone to the section that fixes it:
What you see | Cause to check | Where to fix it |
A long wait before the first game frame (slow FP) | An oversized initial package, Wasm or | Preload startup packages before the tap and Reduce the initial package |
The first frame appears, but controls respond late (a gap between FP and TTI) | Synchronous shader warmup, large JSON parsing, heavy prefab creation, or waiting for bundles after FP | Defer nonessential initialization and Load first-scene assets first |
TTI stays Pending or isn't reported, or subpackage collection doesn't finish | The | |
Repeat launches or level revisits download the same remote assets again | No Cache domain List, bundles larger than 10 MB, URLs without versions, or cached |
Report time to interactive
Report sceneId: 9999 as soon as your first playable scene and its input controls respond. Startup details on the phone and DevTool subpackage collection both rely on this report.
You must call reportScene({ sceneId: 9999 }) once per launch, when real gameplay can begin. Never report it on a static cover, a loading bar, or a lobby where tapping Play starts another long load.
Report TTI in JavaScript
For JavaScript, Cocos, and other JavaScript engines. The reportScene() API was added in Mini Games SDK 0.26.0 and TikTok 45.4.0. For details, see the SDK changelog.
// Call once per launch when real gameplay and input controls are ready.
let ttiReported = false;
export function reportPlayableOnce() {
if (ttiReported) return;
ttiReported = true;
try {
if (typeof TTMinis === 'undefined' || !TTMinis.game ||
typeof TTMinis.game.reportScene !== 'function') {
return;
}
TTMinis.game.reportScene({
sceneId: 9999,
success: () => console.log('TTI 9999 reported'),
fail: (err) => console.warn('TTI 9999 report failed:', err),
});
} catch (err) {
console.warn('reportScene unavailable:', err);
}
}Report TTI in Unity
Call ReportReadyOnce() once per launch, after the TikTok SDK for Unity initializes and the first playable scene accepts input. For details, see Event Reporting.
using TTSDK;
using TTSDK.UNBridgeLib.LitJson;
using UnityEngine;
public static class TtiReporter
{
private static bool s_reported;
public static void ReportReadyOnce()
{
if (s_reported) return;
s_reported = true;
var scene = new JsonData();
scene["sceneId"] = 9999;
TT.ReportScene(
scene,
success: _ => Debug.Log("TTI 9999 reported"),
failed: (code, message) =>
Debug.LogWarning($"TTI 9999 failed: {code}, {message}"),
complete: () => { });
}
}Review live TTI distributions, such as the median and P90, together with the share of launches that reach gameplay and the startup exit rate. TTI counts only launches that reported 9999, so players who leave during loading don't appear in TTI averages.
Preload startup packages before the tap
From eligible live entries, such as in-feed ads, the TikTok app can download startup packages before the player taps Play now. This reduces the download time after the tap on a first visit.
- Initial package: The TikTok app automatically preloads the entry's initial package, which is the main package or an independent subpackage, when conditions allow. Keep only bootstrap code and first-screen essentials in this package.
- Startup subpackages (Cocos and JavaScript projects): After you report
sceneId: 9999, run Subpackage Collection in DevTool on a phone. It records the subpackages loaded before TTI, so the TikTok app can preload them on Wi-Fi and when bandwidth is idle. For the steps, see Optimize Mini Game Performance. - Unity projects: Unity builds don't use subpackage collection. Split the WebAssembly startup code instead. For details, see Split Wasm code.
Note: Preloading is best effort and might not finish before every tap. Your game must always run its normal subpackage or bundle loading path when files haven't been preloaded.

Reduce the initial package
When preloading hasn't run or is incomplete, every megabyte in your initial package delays FP. Remove unused assets, move content needed after launch out of the startup package, and check that startup scripts no longer wait for the moved bundles.

Optimize Unity packages, compression, and Wasm
Apply these five settings in Unity projects. For a detailed walkthrough, see Manage Packages and Assets.
- Split local and remote bundles: Keep only bootstrap UI and Level 1 assets local, and move later levels, skins, and audio to remote CDN paths. You must turn on ClearStreamingAssets, so remote bundles aren't duplicated inside the data package.
- Use LZ4 compression and WebGL texture overrides: You must compress AssetBundles and Addressables with LZ4, never LZMA or uncompressed. Apply ASTC, Crunch, or lower Max Size overrides to large RGBA32 textures.
- Check the release export settings: Set IL2CPP Code Generation to OptimizeSize (Disk Size with LTO), set Build Option to None, turn on Strip Engine Code and Brotli Compress, and export with Build (Release).
- Configure remote CDN caching: Register your HTTPS host, add it to Cache domain List, list the
.hashand.jsonfiles that change in Uncache Files, turn on Append Hash to Filename, and keep each bundle under 10 MB. - Split Wasm code: Turn off WebAssembly 2023 and Bulk Memory first, then follow Split Wasm code. This requires a test account outside the US and EU. Check both uncached and cached launches in the startup details.
Split Cocos bundles and JavaScript subpackages
- Keep the main package under 4 MB: Keep only the entry script, minimal startup UI, and first-screen sprites and audio in the main package. Move later levels, secondary modes, and shop assets into subpackages declared in
game.json, or into remote Asset Bundles. - Check scene asset references: Moving files into another directory doesn't remove them from startup if your entry scene or startup scripts still reference them directly.
- Use the engine and platform subpackage workflows: For Cocos Creator, see Build Mini Games With Cocos. For JavaScript projects that use
TTMinis.game.loadSubpackage(), see Load a regular subpackage.
Defer nonessential initialization
After startup packages finish downloading, CPU and GPU work on the main thread determines how quickly the game goes from FP to TTI. Run only what the first playable screen requires, and move other work until after TTI.

- Spread heavy CPU and shader work across frames: Don't warm up a full-game
ShaderVariantCollectionsynchronously, parse JSON files of several megabytes, or create dozens of hidden UI prefabs inAwakeorStart. Warm up only the first scene's shaders. - Run login and asset loading in parallel: Start silent login at the same time as first-scene asset loading, not one after the other. Wait for server save data before entering the level only when first-screen gameplay depends on saved progress.
- Defer features and ad preloads until after TTI: Initialize store catalogs, skin previews, leaderboards, secondary analytics, and rewarded ad preloads (
createRewardedVideoAd()) after you reportsceneId: 9999. For details, see Preload Ads.
For Unity, see optimize your game menu for faster loading and the Unity 6 script execution order.
Load first-scene assets first
Splitting packages controls how files are delivered. Scene loading controls when your engine loads them into memory. Make the first scene wait only for the assets the opening session uses, then download the next level in advance during play.
- Group first-scene assets to avoid chains of requests: Pack first-screen sprites, UI atlases, and audio by scene instead of sending dozens of small HTTP requests, and reuse cached bundles across launches. For details, see Manage cached assets and updates.
- Download the next subpackage in advance in Cocos or JavaScript: Call
TTMinis.game.preDownloadSubpackage({ name })during Level 1.onProgressUpdatetracks the download progress. You still must callloadSubpackage()when the player enters the scene, to run its code. - Download the next bundle in advance in Unity: After Level 1 is stable, download only the next Addressables or AssetBundle group in the background, without taking frame rate or memory from current gameplay.
Note: A download that reaches 100% doesn't mean the scene is ready. Wait until the engine finishes loading assets, creating scene objects, and turning on input handlers before you switch scenes or report TTI.
For engine details, see Cocos Creator 3.8 Asset Bundle and the Unity Addressables scene loading sample.
Offer practice while the remaining assets load (optional)
In casual action games, rendering and touch input can be ready before the level's obstacles or remote bundles arrive. You can let the player practice the core controls with lightweight startup sprites while the remaining first-level assets load.
- Use only time the player already waits: Never add an artificial delay, and don't require a fixed number of practice taps if the level's assets are already ready.
- Keep the perceived wait separate from TTI: Practice makes the wait feel responsive, but it doesn't reduce TTI. Check that practice rendering doesn't slow background downloads, and report
sceneId: 9999only when real gameplay begins. - Move directly into gameplay: Match the visuals of the ad entry, run practice without a score or failure, and carry the character's current position into Level 1 when the assets load, without another tap on Start.
