Agora provides an open-source API-Example-Unity sample project on GitHub. This document introduces how to run this project and experience a video call implemented by the Agora SDK.
Unity 2017 or later (the interface description in this article is based on Unity 2018.4.28f1).
Unity Hub 1.0.0 or later (the interface description in this article is based on Unity Hub 2.4.3).
Operating system and IDE requirements:
|Target platform||Operating system version||IDE version|
|Android||Android 4.1 or later||Android Studio 3.0 or later|
|iOS||iOS 8.0 or later||Xcode 9.0 or later|
|macOS||macOS 10.0 or later||Xcode 9.0 or later|
|Windows||Windows 7 or later||Microsoft Visual Studio 2017 or later|
A valid Agora account.
Create a project in Agora Console, as follows:
Log in to Console, and click in the left navigation menu to enter the Project Management page.
Enter your project name, and select Secure mode: APP ID + Token for the authentication mechanism in the pop-up window.
Click Submit. You can see the created project on the Project Management page.
Agora automatically assigns each project an App ID as a unique identifier.
To copy this App ID, find your project on the Project Management page in Agora Console, and click the eye icon to the right of the App ID.
To ensure communication security, Agora uses tokens (dynamic keys) to authenticate users joining a channel.
Agora Console supports generating temporary tokens for testing purposes.
On the Project Management page, find your project, and click to open the Token page.
Enter a channel name, and click Generate Temp Token to get a temporary token. When joining the channel, ensure that the channel name is the same with the one that you use to generate the temporary token.
Integrate the Agora SDK into the sample project, as follows:
AgoraEnginefolder on the Project panel.
Connect your device, and run the sample project.
For example, when the sample project runs successfully on a macOS device, you can see the following interface.
If you want to experience a one-to-one video call, you can also use the Agora Web sample app to interact with your macOS device. Ensure that you enter the same App ID, channel name, and temporary token in the Agora Web sample app as in the API-Example-Unity sample app.
See the code of the main functions in the
HelloVideoAgora.cs file of the sample project for your reference.
Agora also provides articles for running the sample project on different platforms as follows: