tencent cloud


Last updated: 2022-06-20 10:19:30

This document shows how to integrate the TRTC SDK in Unity to enable audio/video calls in games.

The demo includes the following features:

  • Room entry/exit
  • Custom video rendering
  • Device management and music/voice effects

  • For details about API features and parameters, please see Client APIs > Unity > Overview.
  • Unity 2020.2.1f1c1 is recommended.
  • Supported platforms: Android, iOS, Windows, macOS (alpha testing)
  • Modules required: Android Build Support, iOS Build Support, Windows Build Support, MacOS Build Support
  • If you are developing for iOS, you also need:
    • Xcode 11.0 or above
    • A valid developer signature for your project


Step 1. Create an application

  1. Log in to the TRTC console and select Development Assistance > Demo Quick Run.
  2. Enter an application name such as TestTRTC and click Create.

Step 2. Download the SDK and source code

  1. Download the SDK and demo source code.

  2. Click Next. You can open the project with Unity, or copy TRTCUnitySDK/Assets/TRTCSDK/SDK in the SDK ZIP file to the Assets directory of your project.

  3. Find and open Assets/TRTCSDK/Demo/Tools/GenerateTestUserSig.cs.

  4. Set parameters in GenerateTestUserSig.cs as follows:

    • SDKAPPID: `0` by default. Set it to the actual `SDKAppID`.
    • SECRETKEY: left empty by default. Set it to the actual key.

Step 3. Compile and run

  1. Open Unity Editor, go to File > Build Settings, and select Android for Platform.
  2. Connect to a real Android device and click Build And Run to run the demo.
  3. Call enterRoom first and go on to test other APIs. The data display window shows whether the call is successful, and the other window displays the callback information.


The demo integrates most of the APIs launched so far, which can be used for testing and as reference for API calls. For more information about APIs, see Client APIs > Unity > Overview.


The UI of the latest version of the demo may look different.

Directory Structure

├── Editor                        // Unity Editor script
│   ├── BuildScript.cs            // Unity Editor build menu
│   ├── IosPostProcess.cs         // Script for building iOS application in Unity Editor
├── Plugins
│   ├── Android                   
│   │   ├── AndroidManifest.xml   //Android configuration file
├── StreamingAssets               // Audio/video stream files for the Unity demo
   ├── Demo                      // Unity demo
   ├── SDK                       // TRTC SDK for Unity
       ├── Implement             // Implementation of TRTC SDK for Unity
       ├── Include               // Header files of TRTC SDK for Unity
       └── Plugins               // Underlying implementation of TRTC SDK for Unity for different platforms
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support