Skip to content

Video ads

Requirements for Advertisements

Please be sure to read our advertisement requirements, since your game will be rejected without any feedback if it doesn't follow them.

The Ad module contains functionality for displaying video ads and for detecting adblockers. It can be accessed like this:

CrazySDK.Ad;

Info

For a demo, please consult the CrazySDK/Demo/AdModule scene. You can run it directly in the Unity editor.

Playing an Advertisement

We support two different types of video ads: midgame and rewarded.

Midgame advertisements can happen when a user died, a level has been completed, etc.

Rewarded advertisements can be requested by the user in exchange for a reward (An additional life, a retry when the user died, a bonus starting item, extra starting health, etc.). Rewarded ads should be shown when users explicitly consent to watch an advertisement.

Displaying an advertisement is done like this:

// for rewarded ad use CrazyAdType.Rewarded
CrazySDK.Ad.RequestAd(CrazyAdType.Midgame, () =>
{
    /** ad started */
}, (error) =>
{
    /** ad error */
}, () =>
{
    /** ad finished, rewarded players here for CrazyAdType.Rewarded */
});

Info

Your game will automatically be paused when the ad is being requested, and be continued when the ad finishes playing.

The adError callback is also triggered if the ad is not filled.

Passing callbacks is optional, so this is also a valid call:

CrazySDK.Ad.RequestAd(CrazyAdType.Midgame, null, null, null);

Adblock detection

Info

We require games to function even when the user has an adblocker. The detection is not foolproof, and it would be very frustrating for a user not running any adblock to get a non-functional game. You can block extra content, such as custom skins, or some levels, to motivate the user to turn off their adblock. Also, keep in mind that turning off the adblock usually requires a page refresh. Make sure that the progress is saved, or the user may just decide to stop playing your game.

There are 2 ways of checking if the user has an active adblocker:

Via property

CrazySDK.Ad.AdblockStatus

Initially, the status will be AdblockStatus.Detecting. It will switch soon to AdblockStatus.Present (if there is an active adblocker) or AdblockStatus.Missing.

Via callback

You can also subscribe a callback to be called when the adblock is detected. You can also call HasAdblock even after the adblock is detected, and the provided callback will be called instantly.

There may be issues however if the scene changes in the meantime and the adblock detection is executed later, as now callbacks subscribed by the previous scenes may fail.

It is safer to use this method on singleton objects, or objects marked with DontDestroyOnLoad.

CrazySDK.Ad.HasAdblock((adblockPresent) => { print("Adblock present:" + adblockPresent); });