-
Notifications
You must be signed in to change notification settings - Fork 5
Banner ads
If you have not created ad spaces or downloaded SDK, please refer to the link below.
If you have not imported Unity package into project, please follow the link below.
Procedure is as follows.
Choose “GameObject” > “CreateEmpty”. Create empty GameObject
.
Change the name of GameObject
you created just now to unique one.
Add “Assets/NendAd/Scripts/AD/NendAdBanner.cs” to GameObject
.
If you create multiple ad spaces, plelase repeat the same procedure. GameObject
names have to be unique.
Name GameObject
such as NendAdBanner1, NendAdBanner2 so that they are unique.
NendAdBanner class provides the following IF's.
- Show/Hide Ads
- Pause/Restart Ad rotation
- Layout setting(added at v1.2.0)
using UnityEngine.SceneManagement;
using NendUnityPlugin.AD;
void GoToOtherScene ()
{
var banner = gameObject.GetComponent <NendAdBanner> ();
banner.Pause ();
banner.Hide ();
SceneManager.LoadScene ("OtherScene");
}
Next, you set ad space information, placement etc. on Inspector.
Account infromation for each OS. OS that is not included in “Build” does not require input.
Item | Explanation |
---|---|
Api Key | Input the apiKey issued provided from management screen. |
Spot Id | Input the spotId provided from management screen. |
You can set up if you want to show a banner ad after a schene starts up.
Use this function if you want to show banner ads only when you want to.
Item | Explanation |
---|---|
ON | Banner ads appear after a scene starts up. |
OFF | Banner ads do not appear after a scene starts up. |
This function allows you to auto-adjust your ad sizes, depending ot the screen sizes.
Please see nendSDK-iOS and nendSDK-Android manual for details.
Item | Explanation |
---|---|
ON | Auto-adjust is on. |
OFF | Auto-adjust is off. |
This function allows you to set banner ad size.(iOS only)
Item | Explanation |
---|---|
Size_320×50 | Show ads in 320×50 size. |
Size_320×100 | Show ads in 320×100 size. |
Size_300×100 | Show ads in 300×100 size. |
Size_300×250 | Show ads in 300×250 size. |
Size_728×90 | Show ads in 728×90 size. |
Banner ads' backgroud color can be set by this function.
Set the position of banner ads by height and width. Default setting is upper left.
Item | Explanation |
---|---|
Size | Input number for setting. |
LEFT | Show ads to the left. |
TOP | Show ads to the top. |
RIGHT | Show ads to the right. |
BOTTOM | Show ads to the bottom. |
CENTER_VERTICAL | Show ads to the vertical center. |
CENTER_HORIZONTAL | Show ads to the horizontal center. |
Set margins of banner ads.
Unit for Android is dip and for iOS is pt.
If you set Gravity, margin is counted from the point where Gravity is set.
Item | Explanation |
---|---|
Left | Set left margin. |
Top | Set top margin. |
Right | Set right margin. |
Bottom | Set bottom margin. |
You can receive event information such as ad-load, click etc. by adding delegation method to NendAdBanner EventHandler
.
using NendUnityPlugin.AD;
using NendUnityPlugin.Common;
...
NendAdBanner banner = ...;
banner.AdLoaded += OnFinishLoadBannerAd;
banner.AdReceived += OnReceiveBannerAd;
banner.AdFailedToReceive += OnFailToReceiveBannerAd;
banner.AdClicked += OnClickBannerAd;
banner.AdBacked += OnDismissScreen;
banner.InformationClicked += OnClickInformation;
...
public void OnFinishLoadBannerAd (object sender, EventArgs args) {
UnityEngine.Debug.Log ("Ad load is completed.");
}
public void OnClickBannerAd (object sender, EventArgs args) {
UnityEngine.Debug.Log ("Ad is clicked");
}
public void OnReceiveBannerAd (object sender, EventArgs args) {
UnityEngine.Debug.Log ("Successfully received ads.");
}
public void OnFailToReceiveBannerAd (object sender, NendAdErrorEventArgs args) {
UnityEngine.Debug.Log ("Failed to receive ads.Error message: " + args.Message);
}
public void OnDismissScreen (object sender, EventArgs args) {
UnityEngine.Debug.Log ("Ads recored on the screen.");
}
public void OnClickInformation(object sender, EventArgs args) {
UnityEngine.Debug.Log ("Information button is clicked and the user moved to the opt-out page.");
}