Other Unity APIs
Adjust the log level
You can control the number of log messages that show up from App Center in the console. Use the
LogLevel-API to enable additional logging while debugging. By default, it's set to
ASSERT for the App Store environments and
To have as many log messages as possible, enable
LogLevel.Verbose in the App Center settings or within your code.
AppCenter.LogLevel = LogLevel.Verbose;
The App Center SDK creates a UUID for each device once the app is installed. This identifier remains the same for a device when the app is updated. A new identifier is generated only when the app is reinstalled. The following API is useful for debugging purposes.
System.Guid? installId = await AppCenter.GetInstallIdAsync();
The App Center SDK supports setting a user ID that is used to augment crash reports. To use this capability:
- Configure the App Center SDK as described in the App Center SDK Getting started guide.
- Set a
userIDin the SDK using the following code:
After setting a user ID, you can use App Center's search feature to search for specific crash reports associated with the ID. Learn more in App Center's search documentation.
The value for the user ID is limited to 256 characters. It will be shown with your crash reports but not used for aggregation or counts of affected users. In case you set User ID multiple times, only the last User ID will be used.
Disable all services at runtime
If you want to disable all App Center services at once, use the
Enabled property. When disabled, the SDK won't forward any information to App Center.
To enable all services at once again, use the same API but pass
true as a parameter.
You don't need to await this call to make other API calls (such as
The state is persisted in the device's storage across application launches.
Change state of service in runtime
You can enable or disable desired service at the runtime with following code:
Check if App Center is enabled
You can also check if App Center is enabled or not.
bool enabled = await AppCenter.IsEnabledAsync();
Check App Center SDK version at runtime
You can get the version of App Center SDK that you're currently using.
Use custom properties
App Center allows you to define custom properties as key value pairs in your app. You may use custom properties for various purposes. For instance, you can use custom properties to segment your users, and then send push notifications to those segments by creating targeted audiences.
Only devices that have Push successfully registered are matched in audiences. Make sure to refer to the relevant getting started documentation depending on the platform you are targeting. As a consequence, the iOS simulator can not be used to test audience matching.
You can set custom properties by calling the
SetCustomProperties() method. A valid key for custom property should match regular expression pattern
^[a-zA-Z][a-zA-Z0-9]*$. A custom property's value may be one of the following C# types:
CustomProperties properties = new CustomProperties(); properties.Set("color", "blue").Set("score", 10).Set("now", DateTime.UtcNow); AppCenter.SetCustomProperties(properties);
If you set the same custom property more than once, previous values will be overwritten by the last one.
You may remove any custom property by calling the
Clear() method. This method will only remove the value of the property for a device. It won't remove the property name from App Center portal.
CustomProperties properties = new CustomProperties(); properties.Clear("score"); AppCenter.SetCustomProperties(properties);
Delay the start of App Center
There may be cases where you want to delay the start of App Center until after AppCenterBehavior starts. For example, if you want to request user consent before starting any App Center services.
To do this, add AppCenterBehaviorAdvanced to the game object and check the Start native SDK from iOS/Android app checkboxes. This will start the SDK the in
Start method of AppCenterBehavior and allow you to add a custom dialog or other logic you may require.
If you generate the settings at build time, another way is to go to Player Settings > Other Settings > Scripting Define Symbols and paste