Skip to main content
Version: Latest

AIPlayer Set up

Full setup process (4 steps)
  • Step 1: Configure Unity Scene (AIHumanSDK, AIPlayer, AIPlayerUI prefab placement)
  • Step 2: Prepare AppID, authentication key, and platform that will be used in the Authenticate function
  • Step 3: Get the AI to use by implementing the Authenticate response
  • Step 4: Initialize AIPlayer to the desired AI

Step 1. Configure Unity Scene

  • Configure the scene by referring to AI Human QuickStart.
  • It is not necessary to use the AIHumanSDK prefab. Since AIHumanSDK Prefab and AIHumanSDKManager scripts are provided for SDK user convenience, you can call the AIHumanSDKManager.Instance.Authenticate(appId, userKey, platform, onComplete) function.
  • The AIPlayerUI prefab is also provided for SDK user convenience, so it is not necessary to use it, and you can create a custom UI or material to apply the textures provided by AIPlayer.

The Authenticate function requires 3 parameters. These four are AppID, UserKey, and Platform information.

UserKey is a unique string generated by DeepBrain AI and should never be disclosed. If you call the API using this authentication key, you will receive available Default AI data and a token to be used in the future. Platform selects one of Android, iOS, and Windows in consideration of the user's App Platform.

If token refresh is required because the token expired, it can be refreshed by calling Authenticate() again.

Step 3. Implement Authenticate and Get the AI list

If you have prepared all the necessary information in the second step process, preparations for authentication are completed. We deliver authentication information as a parameter of the AIHumanSDKManager.Instance.Authenticate function and implement the callback function. If authentication is successful, it returns a list of available AIs. If there is no AI available, aiList returns null.

AIHuman.SDK.AIHumanSDKManager.Instance.Authenticate("appId", "userKey", Platform.Android, (aiLIst, error) =>
{
string message = string.Empty;
if (error == null && aiLIst != null)
{
message = string.Format("Auth Complete, Avaliable Count : {0}", aiLIst.ai.Length);

/* e.g.)
"ai":[{"aiName":"vida","aiDisplayName":"Vida","language":"en"},
{"aiName":"bret","aiDisplayName":"Bret","language":"en"},
{"aiName":"danny","aiDisplayName":"Danny","language":"en"},
{"aiName":"kang","aiDisplayName":"Kang","language":"ko"}]
*/
}
else
{
message = string.Format("Auth Error : {0}", error);
}
Debug.Log(message);
});

Step 4. Initialize AIPlayer to the desired AI

After checking the list of AIs that can be authenticated and used, the initialization process of AIPlayer is required to apply the desired AI. You can call the AIPlayer.Init(string aiName, IAIPlayer Callback callback, IFrameImageProvider imageProvider) function, and you can also call the Init() function when you need to replace it with another AI.

If the AIPlayer is successfully initialized, the AIPlayer downloads the resource according to the set value and changes to an operational state. In addition, when calling the AIPlayer.Init() function, the AI operational status can be reported in the AIPlayerCallback passed as a parameter.