Setup
This page explains how to set up AndApp SDK for Unity.
Importing SDK
Start Unity Project, and then import AndAppSDK.unitypackage.
Setting for Unity Editor
When AndAppSDK.unitypackage is imported, the “AndApp” menu is added to the Unity menu bar.
Clicking “AndApp” -> “Configuration”, then the configuration panel is opened in Inspector.
Register the following setting required for using AndApp SDK, and then click the Save button.
Items | Details |
|---|---|
Client ID | ID issued in AndApp Developer Dashboard. |
Disable Logging | If it is ON, the log output from AndApp SDK is disabled. |
Initializing SDK
SDK should be initialized for using functions of AndApp SDK.
Call AndApp.SDK.Initialize as follows, then SDK is initialized.
void Start () {
if (!AndApp.SDK.IsInitialized) {
AndApp.ConfigBuilder builder = AndApp.ConfigBuilder.Instance();
builder.LoadFromFile(); // Read the file generated by the setting panel on UnityEditor
AndApp.SDK.Initialize(builder, (error, launchOption) => {
if (error != null) {
// If an error occurs, notify the user and quit the application
displaySystemErrorMessage();
return;
}
// Call other API after Initializing
});
}
}
Starting same processes several times causes calling the initialization method of AndApp (AndApp.SDK.Initialize()) several times with same client ID, which should be avoided.
-
AndApp.SDK.Initialize should be implemented to be called by the given object read at first
-
AndApp SDK generates GameObject dynamically and sets DontDestroyOnLoad during initialization so as to detect the stop and restart of an application
Changing Persistence Data Path (Optional)
If Application.persistentDataPath and Application.temporaryCachePath are used or you would like to persist data per game user, change the path to the path returned by the following method. (This process is required for building AndApp SDK in.)
method | description |
|---|---|
| AndApp.Storage.persistentDataPath | For the replacement of Application.persistentDataPath. |
| AndApp.Storage.temporaryCachePath | For the replacement of Application.temporaryCachePath. |
Update History
- August 15, 2016
- The callback argument passed to AndApp.SDK.Initialize was (error) => {}, which is not correct. It is properly fixed to be (error, launchOption) => {}.
- July 28, 2016
- The setting method was added
- Minor modifications
- June 6, 2016
- Newly created