You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The complete TikTok Mini Game SDK is shipped in this repo as a single Unity package.
Drag-and-drop it into any Unity 2022.3 project, or follow
Integrating the SDK for the full step-by-step.
A reference Unity project that integrates the TikTok Mini Game SDK (TTSDK) and exposes
every public TT.* API through clickable buttons grouped by category. The log panel mirrors
every callback so you can see exactly what each API returns, both inside Unity Editor and
inside the real Douyin (TikTok) mini-game container.
Collapsed home
After Init SDK + a few calls
What's in this repo
Path
Purpose
com.tiktok.minigame@1.1.1-Release.unitypackage
Ready-to-import SDK package (TTSDK v1.1.1). Drag-and-drop into any Unity 2022.3 project.
Assets/Plugins/com.tiktok.minigame/
The SDK already imported into this project.
Assets/Demo/Scripts/DemoMainMenu.cs
Runtime menu — accordion-style category list, one button per TT.* API, log panel.
Company / product name as you wish — they're surfaced in the container UI
Confirm the WebGL platform-specific dll filters in PluginImporter (Unity should do this
automatically from .meta): ttsdk.dll ticked only for WebGL, ttsdk-editor.dll ticked
only for Editor.
That's it — using TTSDK; becomes available.
Initializing the SDK
Initialization is a single async call. Every container-dependent API (Login / Pay / Ads /
Share / …) requires this to succeed first.
Mock returns reasonable defaults so you can iterate on the UI / wiring without rebuilding WebGL every time.
WebGL build inside Douyin Developer Tools or production
TTAPIImpl via ttsdk.dll
Talks to the real container; logins / payments / ads behave for real.
You must use SDK ≥ 1.1.1 for Editor mock to work — earlier versions only shipped the
WebGL-target dll and would throw NotSupportedException: 不支持的平台 in Editor.
API reference
The demo covers every public TT.* API in v1.1.1. Buttons are grouped under collapsible
category headers; each row below is one button.
For the exact field shape of each Param type, see the SDK source under
Assets/Plugins/com.tiktok.minigame/TTSDK/Modules/Interface/*, or open the
com.tiktok.minigame package in your IDE for IntelliSense.
Building to TikTok mini game
The SDK ships its own build pipeline that produces the WebGL bundle plus the metadata
files the Douyin developer tools expect.
Open menu: Window → TTSDK → Build Tool.
Fill in your AppID, game version, etc.
Click Build — the bundle lands in ./tt-minigame/webgl/ along with a game.json
that includes the sdkVersion field (auto-injected by SDK 1.1.1).
Upload tt-minigame/ to the Douyin developer back-end for preview / review.
Plain Unity File → Build Settings → WebGL also works for a smoke test, but it won't
produce the tt-minigame/ layout the container expects.
Editor playmode notes
TT.InitSDK succeeds in Editor via Mock (with SDK ≥ 1.1.1). Most callbacks return
reasonable demo defaults — they are not representative of production behaviour.
For real device behaviour (haptics, share sheet, payments, ads, real openid), you
must build to WebGL and run inside Douyin Developer Tools or production.
If Init SDK throws NotSupportedException: 不支持的平台, you are most likely using an
older SDK that lacks ttsdk-editor.dll. Re-import the package shipped with this repo.
Project layout
.
├── com.tiktok.minigame@1.1.1-Release.unitypackage # SDK package, drop into other projects
├── Assets/
│ ├── Demo/
│ │ ├── Editor/
│ │ │ ├── DemoSceneBuilder.cs # Code-driven scene rebuild
│ │ │ └── DemoSetup.cs # One-click setup pipeline
│ │ ├── Scenes/MainMenu.unity # Entry scene (built scene 0)
│ │ └── Scripts/DemoMainMenu.cs # Runtime menu + API wiring
│ └── Plugins/com.tiktok.minigame/ # Imported SDK (do not edit)
├── docs/screenshots/ # README assets
├── Packages/manifest.json # Unity package list
├── ProjectSettings/ # Unity project settings
└── README.md / README.zh.md
Troubleshooting
Symptom
Likely cause
Fix
Init SDK throws NotSupportedException: 不支持的平台 in Editor
SDK is older than 1.1.1 (no editor dll)
Re-import com.tiktok.minigame@1.1.1-Release.unitypackage from repo root.
Use the SDK's Build Tool instead (Window → TTSDK → Build Tool).
License
This demo is provided as a reference for external developers. The TTSDK plugin under
Assets/Plugins/com.tiktok.minigame/ is governed by its own license — see the SDK's
package.json and the agreement on the Douyin open platform.
About
Reference Unity 2022.3 demo for the TikTok Mini Game SDK — covers every TT.* API across 14 categories, with bilingual code comments and README.