Douyin Mini-Game Publishing with Unity China Engine: Complete Guide After Navigating Countless Pitfalls
Development Environment Setup
Engine Version: Unity China Engine 1.6.2 Professional Edition
Project Configuration: Unity 1.62 + Instant Game (AutoStreaming) + Addressable Assets
This guide documents the complete workflow for publishing Douyin (TikTok China) mini-games, including all pitfalls encountered and resolved during the process.
Preparation Phase
Step 1: Switching to Mini-Game Mode
Procedure:
- Switch to Minigame platform mode first
- Then switch to Douyin development environment
Critical Note:
After switching, there's no need to change StartSDK to TTSDK within ByteGame—the TTSDK environment is the default setting.
Important Distinction:
This differs significantly from Unity's traditional WebGL build and conversion process. Pay careful attention to this difference.
Step 2: Douyin Developer Tools Preparation
Download Location:
Douyin Developer Tools Download Page
Login Troubleshooting:
If unable to log into Douyin Developer Tools:
- Change network connection DNS to manual configuration
- Primary DNS:
114.114.114.114 - Secondary DNS:
8.8.8.8
Step 3: TTSDK Initialization
Feature Implementation Guide
1. Sidebar Functionality
Documentation Reference:
Implementation Notes:
Sidebar integration requires proper initialization sequence and permission configuration.
2. Sharing Features
Key Differences from WeChat:
Sharing functionality includes both success and failure callbacks—this differs from WeChat's implementation.
Critical Requirement:
Sharing materials can only be submitted in the Douyin backend after you submit your version.
Documentation Reference:
3. Rewarded Video Ads
Implementation Best Practice:
Before creating a new video ad, clear previous cache:
ad.Destroy();Then wait several frames before recreating.
Asynchronous Frame Wait:
await Task.Yield(); // Correct approach
// NOT: await Task.Delay(1); // IncorrectDocumentation Reference:
4. Add to Desktop Feature
Implementation Challenge:
This feature behaves unpredictably and appears to require iOS differentiation, similar to JD.com's implementation.
Important Note:
UNITY_IOS may not work correctly on mini-games. Refer to previous articles for differentiation methods. If unavailable, try switching SDK name prefixes.
Documentation Reference:
5. Publisher Plan
This relates to user acquisition and monetization—technical implementation not covered here.
6. Subscription Features
Requires corresponding operational functionality activation.
Documentation Reference:
7. New Game Cold Start
Not covered in this guide.
8. Live Streaming Companion Game Launch
Not implemented in this guide.
9. Recommended Feed Game Instant Play
Not implemented in this guide.
10. Interstitial Ads
Also known as "full-screen interstitial"—displays an advertisement in the center of the screen.
Documentation Reference:
11. Rewarded Video Ads (IAA Industry)
For IAA (In-App Advertising) Industry:
No need to focus on eCPM values and callbacks.
For Money-Earning Games:
No example content provided here—requires personal data debugging.
Recommendation:
Use multiple IDs for random switching—3 to 5 IDs recommended.
Documentation Reference:
Packaging Process
Platform Selection
Current Example Configuration:
Unity China Engine + Instant Game (AutoStreaming) + Addressable
Critical Distinction:
We're using the Minigame platform, not traditional WebGL. While both ultimately produce WebGL output, the operational procedures differ significantly.
Douyin Documentation:
Douyin Mini-Game Engine Access Guide
Unity China Engine Official Documentation
AutoStreaming Usage:
AutoStreaming Load Documentation
Douyin Deployment:
Packaging:
Critical Configuration: Addressable Remote Load Path
The Challenge
Unlike WeChat mini-games, Douyin mini-games don't provide conversion options.
Specific Issue:
Instant Game's UOS CDN address won't be automatically taken over by Addressable. Manual adjustment of Addressables Profiles' Remote.LoadPath address is required.
Common Problems:
- Adjusting this frequently causes errors
- Project references may display placeholder addresses like
https://dummy.dummy.dummy/
The Solution
Step 1: Create a Script
Create a script in your project with the [Preserve] attribute. No need to mount this script to any game object—simply placing it in the project suffices.
Step 2: Placeholder Replacement
Replace placeholder addresses with the actual CDN address.
Critical Detail:
Add a trailing slash after "content" in the URL.
Step 3: No Addressables Profiles Adjustment Needed
This approach eliminates the need for manual Addressables Profiles configuration.
Build Process
DouYin Profile Configuration
Required Information:
- Fill in DouYin Profile information
- If underlying information isn't visible, click a "Custom" option to expand
Required fields typically include:
- App ID
- App Secret
- Other platform-specific identifiers
Building the Package
Procedure:
- After completing DouYin Profile configuration, click Build
- The build output contains Douyin-uploadable content
- Verify the output structure matches platform requirements
Final Configuration: URL Whitelist
Douyin Mini-Game Requirements
Similar to WeChat mini-games, Douyin requires URL whitelist configuration.
Critical Difference:
Remove the https:// prefix from URLs when adding to the whitelist.
Comparison:
- Douyin: Requires whitelist with domain only (no protocol prefix)
- WeChat: Similar whitelist requirement
- JD.com: No whitelist required
Summary and Best Practices
Key Takeaways
- Environment Setup: Ensure correct platform mode switching before beginning development
- DNS Configuration: Prepare alternative DNS settings for developer tools login issues
- Ad Implementation: Properly manage ad lifecycle with cache clearing
- Addressable Configuration: Manual CDN path adjustment required with placeholder replacement
- Build Process: Complete DouYin Profile before building
- Whitelist Configuration: Remember to remove protocol prefixes
Common Pitfalls Avoided
This guide documents pitfalls encountered during real production deployment, saving significant debugging time for teams embarking on Douyin mini-game publishing.
Recommended Workflow
- Complete all preparation steps before beginning feature implementation
- Test each feature individually before integration
- Verify Addressable configuration early in the process
- Maintain documentation of all platform-specific requirements
- Test thoroughly on actual devices before submission
By following this guide and understanding these documented pitfalls, teams can streamline their Douyin mini-game publishing workflow and avoid common configuration errors.