tencent cloud

Feedback

Last updated: 2022-04-15 19:06:41

    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.

    Prerequisites

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

    Directions

    Step 1. Create an IM app

    1. Log in to the IM console.
      Note:

      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:
      {
      "dependencies":{
      "com.tencent.imsdk.unity":"https://github.com/TencentCloud/TIMSDK.git#unity" 
      }
      }
      

    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. Download the test script, decompress the file, import the decompressed file to the project, and bind TestApi.cs to any scenario.
    2. Select and run the scenario, and enter the SDKAppID, UserID, and UserSig obtained in Step 1 to start the test.

    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 on an iOS device reports the following error?

    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