TikTok for Developers

Docs

Build Mini Games With Unity

TikTok SDK for Unity is for developers building mini games in Unity that still need to run inside TikTok’s mini app environment. It gives Unity projects a bridge to the same client-side capabilities that mini apps rely on in the existing JavaScript-based Mini Games SDK, such as startup, login, payments, sharing, ads, storage, device features, and other platform integrations.

In practice, TikTok SDK for Unity does not replace TikTok’s mini app runtime requirements. Instead, it helps developers package their game for that environment and call the TikTok capabilities their mini game needs on the client side.

This guide shows how to integrate the TikTok SDK for Unity, build your game, and upload a playable package.

Before you start

Requirements

  • TikTok client version: Android and iOS >= 4310 is required to run Unity-based mini games. Configure your mini game’s supported client version to avoid delivery issues.
  • Unity version: Use Unity 2021 or 2022.
  • Package size limit: The uploaded Unity mini game package must be 60 MB or smaller.

Note: Some build outputs (for example, builds with bulk memory enabled) may not support subpackages yet.

Step 1: Download and import TikTok SDK for Unity

Download the TikTok SDK for Unity package file and import it into your Unity project.

Download

Reach out to your TikTok operations representative for the packages:

  • com.tiktok.minigame@1.0.1-Release.unitypackage (recommended)
    • Fixes an issue where TTAssetBundle could fail to load.
  • com.tiktok.minigame@1.0.0-Release.unitypackage (older)

Import into Unity

  1. In Unity, open your project.
  2. Import the downloaded .unitypackage.
  3. Confirm the imported assets.

Step 2: Build your mini game output

After integrating the SDK, build the mini game output that will be uploaded to TikTok.

  1. Build your project using Unity 2021 or 2022.
  2. Locate the generated output folder.

Important: Keep your package under 60 MB. Large data and wasm files can affect performance and ad delivery.

Step 3: Debug locally

  1. Find the tt-minigame directory in your build output.
  2. Follow the mini game debugging guide to debug.

Step 4: Upload your build

Upload the tt-minigame folder.

Option 1: Upload using the CLI (recommended)

  1. Open a terminal.
  2. Change into the tt-minigame folder.
  3. Upload using the CLI upload flow.

Note: We recommend running ttmg dev from inside the tt-minigame folder and uploading via the CLI’s upload command.

Option 2: Upload manually

If you are using a web uploader, upload the entire tt-minigame folder (not individual files).

Step 5: Optimize size and performance (recommended)

If your build is close to the size limit or performance is not meeting expectations:

  1. Review optimization suggestions
  2. If needed, use subpackages


Was this document helpful?
TikTok for Developers