Advertising - VirtueSky/sunflower_2 GitHub Wiki
What
- Support for Max, Admob and IronSource
Use
- Open
AdSetting
: Open tab Advertising
in Magic Panel

- Here, select
Ad Network
and enter the ad unit id you want to use, don't forget add Define Symbol
.
- If you use
Runtime auto init
, Advertising
will be created automatically when you load the scene. Conversely, you would attach Advertising
to the GameObject in the scene so that the ads can be loaded

public void ShowBanner()
{
Advertising.BannerAd(AdNetwork.Max).Show();
// Advertising.BannerAd(AdNetwork.Admob).Show();
// Advertising.BannerAd(AdNetwork.IronSource).Show();
}
public void HideBanner()
{
Advertising.BannerAd(AdNetwork.Max).HideBanner();
// Advertising.BannerAd(AdNetwork.Admob).HideBanner();
// Advertising.BannerAd(AdNetwork.IronSource).HideBanner();
}
public void ShowInter()
{
Advertising.InterstitialAd(AdNetwork.Max).Show().OnCompleted(() =>
{
// handle show inter completed
});
// Advertising.InterstitialAd(AdNetwork.Admob).Show().OnCompleted(() =>
// {
// // handle show inter completed
// });
//
// Advertising.InterstitialAd(AdNetwork.IronSource).Show().OnCompleted(() =>
// {
// // handle show inter completed
// });
}
public void ShowReward()
{
Advertising.RewardAd(AdNetwork.Max).Show().OnCompleted(() =>
{
// handle show reward completed
}).OnSkipped(() =>
{
// handle skip reward
});
// Advertising.RewardAd(AdNetwork.Admob).Show().OnCompleted(() =>
// {
// // handle show reward completed
// }).OnSkipped(() =>
// {
// // handle skip reward
// });
//
// Advertising.RewardAd(AdNetwork.IronSource).Show().OnCompleted(() =>
// {
// // handle show reward completed
// }).OnSkipped(() =>
// {
// // handle skip reward
// });
}
public void ShowAppOpen()
{
Advertising.AppOpenAd(AdNetwork.Max).Show();
Advertising.AppOpenAd(AdNetwork.Admob).Show();
}
Note: If Enable GDPR
- Android: Advertising will only be initialized after user consent allows requesting ads.
- iOS: If ATT is authorized, GDPR compliance will be initialized, and advertising will only be initialized after user consent allows requesting ads. If ATT is not authorized, GDPR compliance will not be initialized, and advertising will proceed without GDPR conditions.
- When using GDPR, make sure you have created the GDPR message in Admob
- Advertising is successfully initialized only when the Android logcat shows
currentAdClient: ...