Introduction to Unity Ads error handling
Review how and where to see Unity Ads SDK error messages to begin troubleshooting your monetization setup.
Read time 1 minuteLast updated a day ago
The Unity Ads SDK provides structured error handling to help developers identify and debug issues that occur during initialization, ad loading, or ad showing. When an operation fails, the SDK returns a
UnityAdErrorHow to display errors
There are a couple of ways to display Unity Ads SDK error messages during development and testing. You can set SDK-generated logs or log error callbacks manually.Use the LogLevel API
With Unity Ads SDK version 4.18.0, you can set the SDK’s internal log level to control how much information displays in the console about an error. This lets you automatically surface warnings, errors, or verbose debug output from the Unity Ads SDK without adding custom print statements. Review the LogLevel API reference and the different log verbosity levels you can set for your Kotlin and Java, Swift, or Objective-C project.Set up your own logging method
You can also manually log SDK errors returned through callbacks using your preferred logging method by following these steps:- Handle the SDK’s error callbacks.
- Retrieve the error code and error message from the returned object.
- Print or log the error using your own logging mechanism.