tencent cloud


Last updated: 2022-08-30 16:46:09

    This document describes how to quickly run the IM demo for Unity.

    Environment Requirements

    Platform Version
    Unity 2019.4.15f1 or later
    Android Android Studio 3.5 or later; devices with Android 4.1 or later for apps
    iOS Xcode 11.0 or later. Ensure that your project has a valid developer signature.


    You have signed up for a Tencent Cloud account and completed identity verification.


    Step 1. Create an IM app

    1. Log in to the IM console.

      If you already have an app, record its SDKAppID and obtain key information.
      A Tencent Cloud account can create a maximum of 300 IM apps. If you want to create a new app, disable and delete an unwanted app first. Once an app (along with its SDKAppID) is deleted, the service it provides and all its data are lost. Proceed with caution.

    2. Click Create Application, enter your app name, and click Confirm.
    3. Select Auxiliary Tools > UserSig Generation and Verification on the left sidebar. Create a UserID and the corresponding UserSig, and copy the signature information for use in Step 5.

    Step 2. Create a Unity project

    Use Unity to create a project, and record the project directory.

    Step 3. Modify the dependency file

    1. Open the project with an IDE (such as Visual Studio Code):
    2. Find Packages/manifest.json based on the directory, and modify dependencies as follows:

    Step 4. Load dependencies

    Open the project in the Unity Editor, wait until dependencies are loaded, and confirm the Tencent Cloud IM is successfully loaded.

    Step 5. Test script

    1. Get the test script (TestApi.cs) and configuration file (Config.cs), enter the SDKAppID, UserID, UserSig, and toUserID in Config.cs, and bind TestApi.cs to Camera of the test scenario.

    2. Click the run button of Unity Editor to start the scenario. Click other test buttons such as Init (initializing the SDK) and Login (logging in to the IM) to perform tests.

      image-20220616115353114 ## FAQs

    What platforms are supported?

    iOS, Android, Windows, and macOS are supported.

    What should I do if clicking Build And Run for an Android device triggers an error, stating no available device is found?

    Check that the device is not occupied by other resources. Alternatively, click Build to generate an APK package, drag it to the simulator, and run it.

    What should I do if an error occurs during the first run for an iOS device?

    If an error is reported for an iOS device after the demo configured as above is run, choose Product > Clean to clean the product, and build the demo again. You can also close Xcode and open it again, and then build the demo again.

    What should I do if Unity v2019.04 reports the following error for iOS?

    Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/UserInterface/Bootstrap.cs(23,20): error CS0117: 'Collab' does not contain a definition for 'ShowChangesWindow'
    Choose Window > Package Manager on the toolbar of the Editor and downgrade Unity Collaborate to 1.2.16.

    What should I do if Unity v2019.04 reports the following error for iOS?

    Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Editor/TMP_PackageUtilities.cs(453,84): error CS0103: The name 'VersionControlSettings' does not exist in the current context
    Open the source code and delete the code snippet of || VersionControlSettings.mode != "Visible Meta Files".

    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