Skip to content

Advertisement

Aprius edited this page Aug 27, 2024 · 24 revisions

Enable Advertising module via menu Tools > Pancake > Wizard > Advertisement

Settings

image

BASIC

  1. Ad Checking Interval

    1. ad availability check time. ex: Ad Checking Interval = 8 checking load ad after each 8 second
  2. Ad Loading Interval

    1. time between 2 ad loads. ex: Ad Loading Interval = 15 the next call to load the ad must be 15 seconds after the previous one
  3. Current Network:

    • the ad neitwork currently used to display ads
  4. GDPR:

    • support gdpr for EU.
    • You need set Delay app measurement is true in GoogleMobileAdSettings image
    • Note that you need to Set up a GDPR message in AdMob Dashboard. If you don't know how, you can take a look at the following document
  5. GDPR Test Mode:

    • set region debug into EU for display popup consent

ADMOB

Install admob sdk via button Install_AdmobSdk waiting for install package completed. When completed you click button AddAdmobSymbol to activation affect of admob plugin

image

image

APPLOVIN

image

  1. Age Restrictd User

    • To ensure COPPA, GDPR, and Google Play policy compliance, you should indicate when a user is a child. If you know that the user is in an age-restricted category (i.e., under the age of 16), set the age-restricted user flag to true

    • If you know that the user is not in an age-restricted category (i.e., age 16 or older), set the age-restricted user flag to false

USAGE

image

Call ad unit via Advertising

Advertising.Banner?.Show();
(Advertising.Banner as IBannerHide)?.Hide()
Advertising.Inter?.Show();
Advertising.Reward?.Show();

Update current use network

  • by default applovin will be used to show ad, you can use the following syntax to change network use to show ad
Advertising.ChangeNetwork("admob");

Chain method

      Advertising.Banner.Show()
            .OnDisplayed(() => { Debug.Log("[ADVERTISING]: banner displayed"); })
            .OnClosed(() => { Debug.Log("[ADVERTISING]: banner closed"); })
            .OnLoaded(() => { Debug.Log("[ADVERTISING]: banner loaded"); })
            .OnFailedToLoad(() => { Debug.Log("[ADVERTISING]: banner failed to load"); })
            .OnFailedToDisplay(() => { Debug.Log("[ADVERTISING]: banner failed to display"); });
    Advertising.Reward.Show()
            .OnDisplayed(() => { Debug.Log("[ADVERTISING]: rewarded displayed"); })
            .OnClosed(() => { Debug.Log("[ADVERTISING]: rewarded closed"); })
            .OnLoaded(() => { Debug.Log("[ADVERTISING]: rewarded loaded"); })
            .OnFailedToLoad(() => { Debug.Log("[ADVERTISING]: rewarded failed to load"); })
            .OnFailedToDisplay(() => { Debug.Log("[ADVERTISING]: rewarded failed to display"); })
            .OnCompleted(() => { Debug.Log("[ADVERTISING]: rewarded completed"); })
            .OnSkipped(() => { Debug.Log("[ADVERTISING]: rewarded skipped"); });

Notes

There is a problem with applovin according to their docs

  • Interstitial

Fired when an interstitial ad is displayed (may not be received by Unity until the interstitial ad closes). Admob still work correctly

  • Rewarded

For Applovin : Fired when a rewarded ad is displayed (may not be received by Unity until the rewarded ad closes). Admob still work correctly

This results in Interstitial and Rewarded OnDisplayed callbacks being called at ad closed instead of when the ad is displayed as desired.

  1. Setting scripting symbols for Editor script compilation
If you need to define scripting symbols via scripts in the Editor so that your Editor scripts are affected by the change, you must use PlayerSettings.SetScriptingDefineSymbolsForGroup. However, there are some important details to note about how this operates.

Important: this method does not take immediate effect. Calling this method from script does not immediately apply and recompile your scripts. For your directives to take effect based on a change in scripting symbols, you must allow control to be returned to the Editor, where it then asynchronously reloads the scripts and recompiles them based on your new symbols and the directives which act on them.

So, for example, if you use this method in an Editor script, then immediately call BuildPipeline.BuildPlayer on the following line in the same script, at that point Unity is still running your Editor scripts with the old set of scripting symbols, because they have not yet been recompiled with the new symbols. This means if you have Editor scripts which run as part of your BuildPlayer execution, they run with the old scripting symbols and your player might not build as you expected.
Clone this wiki locally