Development Environment Setup

Engine Version: Tuanjie Engine 1.6.2 Professional Edition

Project Environment: Tuanjie 1.62 + Instant Game (AutoStreaming) + Addressable

This guide documents the complete process of publishing Douyin (TikTok China) mini-games using the Tuanjie Engine, sharing hard-won lessons from overcoming numerous obstacles.

Preparation Steps

Step 1: Switch to Minigame Mode

  1. Switch to Minigame mode in the engine
  2. Then switch to Douyin development environment

Important Note: After switching, there's no need to change StartSDK to TTSDK in ByteGame—TTSDK environment is the default.

Critical Distinction: This differs from traditional WebGL building and conversion in Unity publishing. Pay attention to the differences.

Step 2: Prepare Douyin Developer Tools

Download Page: Douyin Developer Tools

Login Troubleshooting: If unable to log into Douyin Developer Tools, change network connection DNS to manual configuration:

  • Primary: 114.114.114.114
  • Secondary: 8.8.8.8

Step 3: TTSDK Initialization

Feature Implementation Guide

1. Sidebar

Documentation: Sidebar API

Implementation follows standard Douyin mini-game sidebar integration patterns.

2. Sharing Functionality

Documentation: Share Module

Key Difference: Sharing functionality includes success and failure callbacks, differing from WeChat's implementation.

Important Note: Sharing materials can only be submitted in the Douyin backend after you submit your version.

3. Rewarded Video Ads

Documentation: Rewarded Video Ads

Critical Implementation Detail: Before creating a video ad, clear previous cache:

ad.Destroy();

Then wait several frames before recreating.

Asynchronous Wait (one frame):

await Task.Yield();

Do NOT use: await Task.Delay(1);

4. Add to Desktop

Documentation: Add to Desktop

Observation: This feature feels ambiguous, similar to JD.com, potentially requiring iOS differentiation. Note that UNITY_IOS may not work on mini-games. Refer to previous articles for differentiation methods; if unavailable, try switching SDK name prefixes.

5. Publisher Plan

This relates to user acquisition (buying traffic), not technical implementation.

6. Subscription

Documentation: Subscription Introduction

Requirement: Corresponding operational functionality must be enabled.

7-9. Additional Features

The following features weren't implemented in this project:

  • New game cold start
  • Live companion game launch
  • Recommended feed game instant play

10. Interstitial Ads

Documentation: Interstitial Ads

Also known as "full-screen interstitial," displays an ad in the middle of the screen.

11. Rewarded Video Ads (IAA Industry)

Documentation: Incentive Ads

Note: IAA industry doesn't need to focus on eCPM values and callbacks. For money-earning games, no example content provided here—requires self-debugging of data.

Recommendation: Use multiple IDs for random switching; 3-5 IDs suffice.

Packaging Process

Platform Selection

This example uses Tuanjie Engine + Instant Game (AutoStreaming) + Addressable.

Critical Distinction: We're using the Minigame platform, not traditional WebGL. Though both output WebGL, operations differ significantly.

Douyin Documentation: Unity Game Access

Tuanjie Official Documentation

Key Differences from WeChat

Critical Point: Douyin mini-games don't provide conversion options like WeChat mini-games.

Addressable Configuration Challenge

Problem: Instant Game's UOS CDN address won't be automatically taken over by Addressable. Manual adjustment of Addressables Profiles' Remote.LoadPath address is required.

Complication: Adjusting this often causes errors, and project references may show placeholder addresses like https://dummy.dummy.dummy/.

Solution: Script-Based Replacement

Create a script in your project with the [Preserve] label. No need to mount the script on any object—just place it in the project.

Implementation: Replace placeholder addresses with CDN addresses. Ensure a trailing slash after "content".

No Addressables Profiles adjustment required.

Building the Package

DouYin Profile Configuration

  1. Fill in DouYin Profile information
  2. After completion, directly build the package
  3. The build output contains Douyin-uploadable content

Required DouYin Profile Information:

  • Fill all required fields
  • If information isn't visible, click a "Custom" option to expand

Final Build

Click Build to complete the packaging process.

Post-Build Configuration

URL Whitelist

Important: Douyin mini-games require filling in a link whitelist, similar to WeChat, but remove the https:// prefix from links.

Comparison: JD.com mini-games don't require whitelists.

Common Pitfalls and Solutions

Pitfall 1: CDN Address Issues

Problem: Addressable doesn't automatically handle Instant Game CDN addresses.

Solution: Use script-based replacement as described above.

Pitfall 2: DNS Configuration

Problem: Unable to login to Douyin Developer Tools.

Solution: Change DNS to 114.114.114.114 (primary) and 8.8.8.8 (secondary).

Pitfall 3: Ad Implementation Timing

Problem: Rewarded video ads fail to load properly.

Solution: Destroy previous ad instances and wait a frame before recreating using await Task.Yield().

Pitfall 4: URL Whitelist Format

Problem: Links don't work in Douyin mini-game.

Solution: Remove https:// prefix when adding to whitelist.

Conclusion

Publishing Douyin mini-games with Tuanjie Engine requires careful attention to platform-specific differences from traditional Unity WebGL builds and other mini-game platforms. The Instant Game + AutoStreaming + Addressable combination provides efficient asset management but requires manual CDN configuration.

Key success factors include proper DNS configuration for developer tools, correct Ad implementation with frame waiting, and accurate URL whitelist formatting. Following this guide should help avoid common pitfalls encountered during the publishing process.

The Douyin mini-game platform offers significant user reach but demands adherence to specific technical requirements. Proper preparation and understanding of these requirements streamline the publishing process considerably.