Unity
Voximplant supports the latest Unity platforms, so you can add our functionality to your Unity applications and games.
Add Voximplant libraries as a Unity asset
- Download the latest version of Voximplant Unity SDK here.
- In the Unity editor, select Assets > Import package > Custom package. Navigate to the directory where you have the Voximplant Unity SDK and select VoximplantSDK-*.unitypackage.
- Import all assets in the package.
Initialize the SDK
IClient is the main class of the SDK that provides access to Voximplant’s functions, the VoximplantSdk.GetClient()
method is used to get its instance:
VoximplantSdk.Initialize();
_client = VoximplantSdk.GetClient();
_client.Connected += ClientOnConnected;
_client.LoginSuccess += ClientOnLoginSuccess;
Connect and log in to the Voximplant Cloud
The IClient.State
property is used to get the current state of connection to the Voximplant cloud and perform the actions according to it.
private void LoginWithPassword(string login, string password) {
_login = login;
_password = password;
if (_client.State == ClientState.Disconnected)
{
_client.Connect();
}
else if (_client.State == ClientState.Connected)
{
_client.Login(_login, _password);
}
}
private void ClientOnConnected(IClient sender)
{
_client.Login(_login, _password);
}
private void ClientOnLoginSuccess(IClient sender, LoginSuccessEventArgs e)
{
_displayName = e.DisplayName;
}
Start implementing functionality
Now you have your application and SDK set up and successfully connected to the Voximplant cloud. To start implementing desired functionality, such as calls, conferences, messages, and more, go to the Guides section of our documentation and pick the features you need.