Publishing Douyin Mini Games with Unity Engine: Complete Production Guide
Development Environment Setup
Required Tools:
- Tuanjie Engine 1.6.2 Professional Edition
- Project Configuration: Tuanjie 1.62 + Instant Game (AutoStreaming) + Addressable
- Douyin Developer Tools (latest version)
This comprehensive guide documents the complete process of publishing games to the Douyin Mini Game platform using Unity/Tuanjie Engine, including all common pitfalls and their solutions.
Pre-Production Preparation
Step 1: Platform Mode Configuration
- Switch to Minigame Mode: Navigate to the platform settings and select Minigame mode
- Select Douyin Development Environment: Choose Douyin as the target mini game platform
Critical Note: After switching, there's no need to manually change StartSDK to TTSDK within ByteGame—the TTSDK environment is set as default automatically.
Important Distinction: This process differs significantly from traditional Unity WebGL publishing and conversion workflows. Understanding this distinction prevents common configuration errors.
Step 2: Douyin Developer Tools Installation
Download Location: Visit the official Douyin developer documentation for the latest developer tools download.
Network Configuration Tip: If you encounter login issues with the Douyin Developer Tools, modify your network connection DNS settings:
- Primary DNS: 114.114.114.114
- Secondary DNS: 8.8.8.8
This DNS configuration resolves most connectivity issues encountered during developer tool authentication.
Step 3: TTSDK Initialization
The TTSDK (TikTok SDK) provides essential functionality for Douyin Mini Games. Below are the key features and implementation considerations:
Core Feature Implementation
1. Sidebar Functionality
Documentation Reference: Official Douyin Mini Game API documentation covers sidebar implementation details.
Implementation Notes: The sidebar provides quick access to game features and user profile information. Ensure proper initialization sequence to avoid runtime errors.
2. Sharing System
Key Differences from WeChat: Sharing functionality includes both success and failure callbacks, which differs from WeChat's implementation.
Important Requirement: Sharing materials can only be submitted through the Douyin backend after you've submitted your version for review.
Implementation Considerations:
- Implement proper error handling for share failures
- Cache share materials appropriately
- Test sharing flow across different device types
3. Rewarded Video Ads
Critical Implementation Detail: Before creating new video ads, clear previous cache:
// Destroy previous ad instance
ad.Destroy();
// Wait a few frames before recreating
await Task.Yield(); // Use this instead of await Task.Delay(1)Why This Matters: Failing to properly clean up previous ad instances can cause memory leaks and unexpected behavior in ad delivery.
4. Add to Desktop Feature
Platform-Specific Considerations: This feature requires careful iOS differentiation, similar to JD Mini Games. Note that UNITY_IOS may not work as expected on mini games.
Recommended Approach:
- Reference previous implementation articles for differentiation methods
- If standard approaches fail, try switching SDK name prefixes
- Test thoroughly on both iOS and Android devices
5. Publisher Plan
This feature relates to user acquisition and monetization rather than technical implementation. Coordinate with your marketing team for proper setup and tracking.
6. Subscription System
Requirement: Corresponding operational features must be enabled before subscription functionality becomes available.
Implementation Steps:
- Enable required operational features in the Douyin backend
- Implement subscription UI components
- Handle subscription state changes appropriately
7-9. Additional Features (Not Covered)
The following features weren't implemented in this reference project:
- New Game Cold Start
- Live Streaming Companion Game Launch
- Recommendation Feed Instant Play
10. Interstitial Ads
Also known as "full-screen interstitial," these ads appear in the middle of the screen during natural game breaks.
Best Practices:
- Display during natural pause points
- Avoid interrupting critical gameplay moments
- Implement proper frequency capping
- Test ad load times and fallback behavior
11. Rewarded Video Ads (IAA Industry)
For IAA (In-App Advertising): No need to focus on eCPM values and callbacks.
For Money-Earning Games: This section requires individual data testing and optimization.
Recommended Strategy: Use multiple ad IDs with random switching—3 to 5 different IDs typically provides optimal fill rates and revenue optimization.
Packaging Process
Build Configuration
Our example utilizes Tuanjie Engine + Instant Game (AutoStreaming) + Addressable combination:
Platform Selection: We're using the Minigame platform rather than traditional WebGL. While both ultimately produce WebGL output, the operational processes differ significantly.
Official Documentation References:
- Douyin Mini Game Documentation: Complete access flow and engine integration guidelines
- Tuanjie Official Documentation: AutoStreaming usage, Douyin deployment, and packaging guides
Critical Difference from WeChat
Important: Douyin Mini Games don't provide conversion options like WeChat Mini Games. This requires manual configuration of certain paths.
Addressable Configuration Challenge
Problem: Instant Game's UOS CDN address isn't automatically managed by Addressable. Manual adjustment of Addressables Profiles Remote.LoadPath is required.
Common Issues:
- Frequent errors when adjusting Remote.LoadPath
- Placeholder addresses like
https://dummy.dummy.dummy/appearing in project references
Solution: Custom Script Implementation
Step 1: Create a script in your project with the [Preserve] attribute. No need to mount this script to any game object—simply include it in your project.
Step 2: Implement the placeholder replacement method:
[Preserve]
public class AddressablePathFixer
{
[RuntimeInitializeOnLoadMethod]
static void FixRemoteLoadPath()
{
// Replace placeholder addresses with actual CDN addresses
// Ensure content path ends with forward slash
var settings = AddressableAssetSettingsDefaultObject.Settings;
// Implementation details for path replacement
}
}Step 3: Replace placeholder addresses with the actual CDN address, ensuring a trailing slash follows the content path.
Note: No Addressables Profiles adjustment is required when using this approach.
Build Process
Douyin Profile Configuration
- Fill Douyin Profile Information: Complete all required fields in the Douyin profile section
- Expand Custom Options: If certain information isn't visible, click the "Custom" option to expand additional fields
- Execute Build: Click the Build button to generate the package
Required Profile Information:
- App ID (from Douyin developer console)
- App Key (from Douyin developer console)
- Signature/Security configuration
- Any additional platform-specific requirements
Build Output
Upon successful build completion, you'll receive Douyin-uploadable content. The output directory contains all necessary files for submission to the Douyin Mini Game platform.
Final Configuration: URL Whitelist
Important: Douyin Mini Games require URL whitelist configuration, similar to WeChat Mini Games. However, there's a critical difference:
Douyin Requirement: Remove the https:// prefix from URLs in the whitelist.
Example:
- ❌ Incorrect:
https://api.example.com - ✅ Correct:
api.example.com
Comparison:
- WeChat: Requires full URL with protocol
- Douyin: Requires domain without protocol prefix
- JD Mini Games: No whitelist required
Testing and Submission
Pre-Submission Checklist
- Functionality Testing: Verify all core game features work correctly
- Ad Integration: Test all ad types (rewarded, interstitial)
- Sharing Flow: Confirm sharing functionality across different scenarios
- Performance: Check frame rates and memory usage on target devices
- Network: Test under various network conditions
Submission Process
- Upload built package to Douyin Developer Console
- Complete required metadata (description, screenshots, category)
- Submit for review
- Address any feedback from review team
- Publish upon approval
Common Pitfalls and Solutions
Issue 1: Build Failures
Symptoms: Build process fails with unclear error messages
Solutions:
- Verify all profile information is complete
- Check Addressable configuration
- Ensure no Chinese characters in build paths
- Clean and rebuild project
Issue 2: Runtime Errors
Symptoms: Game crashes or behaves unexpectedly after upload
Solutions:
- Verify TTSDK initialization sequence
- Check ad implementation cleanup
- Test on actual devices (not just simulator)
- Review console logs for specific errors
Issue 3: Performance Issues
Symptoms: Low frame rates or excessive memory usage
Solutions:
- Optimize asset loading with AutoStreaming
- Reduce initial download size
- Implement proper asset unloading
- Profile on target devices
Conclusion
Publishing games to the Douyin Mini Game platform using Unity/Tuanjie Engine requires careful attention to platform-specific configurations and implementation details. While the process shares similarities with other mini game platforms, critical differences in URL whitelist requirements, SDK initialization, and build configuration must be understood.
This guide documents the complete workflow based on production experience, helping developers avoid common pitfalls and streamline their Douyin Mini Game publishing process. Success requires thorough testing, proper configuration, and understanding of platform-specific requirements.
The key to smooth publishing lies in following the documented steps precisely, testing thoroughly on actual devices, and maintaining awareness of platform-specific quirks that differentiate Douyin from other mini game ecosystems.