Development Environment Setup

This comprehensive guide documents the complete journey of publishing Douyin (TikTok China) mini-games using Tuanjie Engine, sharing hard-won lessons from navigating numerous technical challenges. Our development setup utilizes Tuanjie Engine 1.6.2 Professional Edition, providing a stable foundation for mini-game development.

Project Configuration

Engine Version: Tuanjie 1.6.2
Integration Stack: Instant Game (AutoStreaming) + Addressable Asset System

This combination enables efficient asset loading and management, critical for mini-game platforms with strict size limitations and performance requirements.


Preparation Steps

Step 1: Platform Mode Switching

The first critical step involves properly configuring the development environment:

  1. Switch to Minigame Mode: Access the platform selection in Tuanjie Engine and choose the Minigame target platform
  2. Select Douyin Development Environment: Within Minigame mode, specifically select the Douyin platform configuration

Critical Distinction: Unlike traditional Unity WebGL builds, the Tuanjie Douyin workflow operates differently. After switching platforms, there's no need to manually change the StartSDK to TTSDK within ByteGame—the TTSDK environment is automatically configured as the default.

Important Note: This differs significantly from Unity's traditional WebGL publishing workflow. Understanding this distinction prevents common configuration errors that waste development time.

Step 2: Douyin Developer Tools Installation

Download Source: Access the official Douyin Open Platform developer tools download page

Installation Process:

  1. Download the latest Douyin Developer Tools installer
  2. Complete standard installation procedure
  3. Launch and verify successful installation

Troubleshooting Login Issues:
If encountering login failures with Douyin Developer Tools, modify your network DNS settings:

  • Primary DNS: 114.114.114.114
  • Secondary DNS: 8.8.8.8

This DNS configuration resolves common connectivity issues preventing developer tool authentication.

Step 3: TTSDK Initialization

Proper TTSDK initialization forms the foundation for all Douyin-specific functionality. The following sections detail critical integration points.


Functional Implementation Guide

Feature 1: Sidebar Integration

Documentation Reference: Douyin Mini-Game Open API - Sidebar Capabilities

The sidebar feature provides quick access to game-related functions and social features. Implementation requires proper SDK initialization and callback handling.

Feature 2: Sharing Functionality

Key Implementation Details:

Sharing functionality includes both success and failure callbacks, differing from WeChat's implementation approach. This distinction requires careful attention during integration.

Critical Requirement: Share assets (images, videos, descriptions) must be submitted and approved in the Douyin backend after version submission before becoming available for use in sharing operations.

Documentation: Douyin Mini-Game Sharing Module API Reference

Implementation Tips:

  • Test sharing callbacks thoroughly in development environment
  • Prepare share assets according to Douyin's specification requirements
  • Submit assets early in the release cycle to avoid approval delays

Feature 3: Rewarded Video Ads

Implementation Best Practices:

Before creating new rewarded video ad instances, always destroy previous cached instances to prevent memory leaks and unexpected behavior:

// Destroy previous ad instance
ad.Destroy();

// Wait several frames before recreating
// Important: Use Task.Yield() instead of Task.Delay(1)
await Task.Yield();

// Create new ad instance

Critical Implementation Note: Use await Task.Yield() for asynchronous frame waiting. Do not use await Task.Delay(1) as it behaves differently in the mini-game environment and can cause timing issues.

Documentation: Douyin Rewarded Video Ad API Reference

Feature 4: Add to Desktop

Implementation Challenge: This feature presents confusion similar to JD mini-game integration. iOS detection may be necessary, but standard UNITY_IOS defines might not function as expected in the mini-game context.

Recommended Approach:

  • Reference previous implementation articles for platform detection strategies
  • If standard detection fails, experiment with SDK name prefix variations
  • Test thoroughly on both iOS and Android devices

Documentation: Douyin Add to Desktop Guide

Feature 5: Publisher Plan (Monetization)

This feature relates to user acquisition and monetization strategies rather than technical implementation. It involves purchasing traffic and user engagement campaigns through Douyin's advertising platform.

Feature 6: Subscription Functionality

Requirement: Corresponding operational features must be enabled in the Douyin backend before subscription functionality becomes available.

Documentation: Douyin Subscription Feature Introduction

Features 7-9: Advanced Integrations

The following features weren't implemented in our current project but are documented for completeness:

  • New Game Cold Start: Optimization for first-launch experience
  • Live Streaming Companion Game Launch: Integration with Douyin live streaming
  • Recommended Feed Game Instant Play: Discovery feed integration

These features require additional backend configuration and are typically implemented in later project phases.

Feature 10: Interstitial Ads

Also Known As: Full-screen interstitial ads appearing mid-screen during gameplay transitions.

Implementation Considerations:

  • Display at natural break points in gameplay
  • Respect frequency capping to maintain user experience
  • Test on various device sizes for proper display

Documentation: Douyin Interstitial Ad Guide

Feature 11: Rewarded Video Ads (IAA Industry)

For IAA (In-App Advertising) Industry:

  • eCPM values and callback handling require less attention
  • Focus on user experience and ad placement optimization

For Money-Earning Games:

  • Data debugging becomes critical
  • Implement your own testing framework for ad performance

Best Practice: Implement random switching between 3-5 different ad unit IDs to optimize fill rates and revenue.

Documentation: Douyin Incentive Ad Guide


Packaging Process

Our packaging approach leverages Tuanjie Engine combined with Instant Game (AutoStreaming) and Addressable asset management.

Packaging Step 1: Platform Selection

Critical Choice: Use the Minigame platform, not traditional WebGL. While both technically output WebGL, the operational workflows differ significantly.

Reference Documentation:

  • Douyin Mini-Game Unity Access Guide
  • Comprehensive platform-specific requirements

Packaging Step 2: Tuanjie Official Documentation

Essential documentation resources:

  1. AutoStreaming Usage: Official guide for implementing asset streaming
  2. Douyin Deployment: Step-by-step upload and deployment instructions
  3. Packaging Guide: Complete build process documentation

Critical Difference: Douyin vs WeChat

Important Distinction: Unlike WeChat mini-games, Douyin does not provide a conversion option in the build interface. This requires manual configuration of certain parameters.

Addressable Configuration Challenge

Problem: Instant Game's UOS CDN address is not automatically managed by Addressable systems, requiring manual adjustment of Addressables Profiles' Remote.LoadPath configuration.

Common Issues:

  • Frequent errors when adjusting Remote.LoadPath
  • Project references showing placeholder URLs like https://dummy.dummy.dummy/

Solution Implementation

Step-by-Step Resolution:

  1. Create Initialization Script:

    • Create a new script in your project
    • Apply the [Preserve] attribute to prevent code stripping
    • No need to attach to any GameObject—simply include in project
  2. Implement Path Replacement:

    • Replace placeholder URLs with actual CDN addresses
    • Ensure trailing slashes are included after content paths
  3. Addressables Profile Configuration:

    • No manual Addressables Profiles adjustment required
    • Script handles path resolution automatically

Build Process

Douyin Profile Configuration:

  1. Fill in Douyin Profile information in build settings
  2. Expand custom options if additional fields aren't visible (look for "Custom" expansion option)
  3. Click Build to generate the package

Build Output: The completed build contains Douyin-uploadable content ready for submission.

Required Douyin Profile Information

The following fields must be completed:

  • App ID (from Douyin developer console)
  • App Secret (from Douyin developer console)
  • Additional configuration as required by your specific implementation

Note: If certain fields aren't visible, click the custom/advanced options to expand additional configuration areas.

Final Step: URL Whitelist Configuration

Important: Douyin mini-games require URL whitelist configuration, similar to WeChat's approach but with one key difference:

Whitelist Format: Remove the https:// prefix from URLs when adding to the whitelist. For example:

  • Actual URL: https://api.example.com
  • Whitelist entry: api.example.com

Comparison: JD mini-games do not require whitelist configuration, making Douyin's requirement a notable difference in the deployment process.


Common Pitfalls and Solutions

Pitfall 1: Build Failures After Platform Switch

Symptom: Build process fails immediately after switching to Douyin platform

Solution:

  • Verify Minigame mode is selected (not WebGL)
  • Check that TTSDK is properly initialized
  • Clean build cache and rebuild

Pitfall 2: Black Screen in Developer Tools

Symptom: Game launches but shows only black screen

Solution:

  • Verify DNS settings (114.114.114.114 / 8.8.8.8)
  • Check Addressable path configuration
  • Ensure all assets are properly included in build

Pitfall 3: Ad Functionality Not Working

Symptom: Ads fail to load or display

Solution:

  • Confirm ad unit IDs are correctly configured
  • Verify operational features are enabled in backend
  • Test with test ad IDs before production deployment
  • Check network connectivity from developer tools

Pitfall 4: Share Assets Not Available

Symptom: Sharing fails or shows placeholder content

Solution:

  • Submit share assets in Douyin backend
  • Wait for approval before testing
  • Verify asset specifications meet requirements

Performance Optimization Tips

Asset Loading Optimization

  • Leverage AutoStreaming for large assets
  • Implement progressive loading for better user experience
  • Monitor memory usage during development

Code Optimization

  • Use AOT compilation where possible
  • Minimize reflection usage
  • Profile regularly to identify bottlenecks

Network Optimization

  • Implement connection retry logic
  • Cache frequently accessed data
  • Use compression for network payloads

Testing Checklist

Before submission, verify:

  • [ ] All ad implementations tested with test IDs
  • [ ] Sharing functionality works on target devices
  • [ ] Add to desktop feature functions correctly
  • [ ] No console errors in developer tools
  • [ ] Performance meets platform requirements
  • [ ] URL whitelist properly configured
  • [ ] All required permissions requested
  • [ ] Privacy policy and terms accessible

Conclusion

Publishing Douyin mini-games with Tuanjie Engine presents unique challenges distinct from traditional Unity WebGL deployment or even WeChat mini-game publishing. The key differences lie in:

  1. Platform Configuration: Minigame mode vs traditional WebGL
  2. SDK Initialization: Automatic TTSDK configuration
  3. Build Process: No conversion option, manual path configuration
  4. Deployment Requirements: URL whitelist without https prefix

By understanding these distinctions and following the documented procedures, developers can successfully navigate the Douyin mini-game publishing process. The lessons shared in this guide represent countless hours of troubleshooting—use them to accelerate your own development journey.

Remember that each mini-game platform has its own quirks and requirements. What works for WeChat may not apply to Douyin, and traditional Unity workflows require significant adaptation. Stay patient, test thoroughly, and leverage community knowledge to overcome obstacles.

Final Advice: Start with simple implementations, verify each feature individually, and gradually build complexity. This incremental approach makes debugging significantly easier and reduces frustration during development.