This section describes how to integrate the AppBrain SDK into your Unity app and start monetizing it.
To make integration even easier, the AppBrain SDK for Unity comes bundled with some scripts for common use cases. The scripts are located in <MyProject>/Assets/Plugins/Android/AppBrain/Scripts.
The recommended way to use AppBrain in a game is to show the AppBrain interstitial when the player completes a level. You can use the script LevelCompleteInterstitial.cs to do this. The class LevelCompleteInterstitial is meant to be extended so you can override its OnNextLevel() method. LevelCompleteInterstitial itself extends Unity’s MonoBehaviour class, so it can easily be used by any game object.
// TODO: Add logic to proceed to the next level.
ExitInterstitial.cs: Shows an AppBrain interstitial when the user exits your app. Simply attach this script to one of the main objects (for instance the camera) of your main scene, and you will automatically get the interstitial on back press.
OfferWallButtonListener: Attach this script to a Unity button, and set the parameter myButton to the button. The AppBrain offer wall will then be opened when the button is clicked.
Note that AppBrain banners are currently not available from Unity. Feel free to contact us directly at contact@appbrain.com if you need any assistance.
If you encounter errors when building your apps in Unity, please change the Build System setting to use Gradle.
In the Unity editor go to “Build Settings”, choose Android, then change the “Build System” option from “Internal (Default)” to “Gradle (New)”.