Monetize

Last Updated on

July 15, 2022

Unity (delegate methods)

Overview

The Chartboost SDK's delegate methods allow you to exercise a greater degree of control over your integration. For example, you can:

  • Log debug messages when your game attempts to load an interstitial.
  • Prevent ads from showing the first time a user plays your game.
  • Determine whether a user has clicked an ad or just closed it  and react accordingly.
  • Prevent an interstitial page appearing when and where it would interfere with your game.

You can view the Chartboost Unity SDK methods at your disposal in the Chartboost.cs file (found in the imported Unity plugin files (Chartboost > Scripts > Chartboost.cs). You can see a good example of how to implement many of these methods in the ChartboostExample.cs file (Chartboost > Examples > ChartboostExample.cs) within the sample scene included with your Unity SDK download.

SDK configuration methods

Click here to view Unity configuration methods. 

SDK delegate setup

The Chartboost Unity SDK implements its delegate functionality using C# style delegates and events. Before using any of the delegate methods, you should first subscribe to the relevant SDK events in your MonoBehaviour as demonstrated:

Don't make cache or show calls inside didFailToLoad delegates or the universe will implode. You should also make sure to unsubscribe to those same events when appropriate:void OnDisable() {

Don't make cache or show calls inside didFailToLoad delegates or the universe will implode.

 Feel free to subscribe to all events as above, or just the ones you need. Then proceed to implement the relevant delegate methods to handle responses to each event.

Static & video interstitial delegate methods

Don't make cache or show calls inside didFailToLoad delegates or the universe will implode.Note: "didDisplayInterstitial" and "didDisplayRewardedVideo" are deprecated from Unity Android, we advise to use "willDisplayVideo", "shouldDisplayInterstitial", "shouldDisplayRewardedVideo" based on your needs instead

Rewarded video delegate methods

Don't make cache or show calls inside didFailToLoad delegates or the universe will implode. 

Misc. delegate methods

Don't make cache or show calls inside didFailToLoad delegates or the universe will implode. 

Age gate delegate methods


Don't make cache or show calls inside didFailToLoad delegates or the universe will implode.