Loading a Rewarded Ad
The rewarded ad is automatically loaded with the default placement id. If no other placements are needed, call ShowRewardedVideoAd.
Showing a Rewarded Ad
Warning
Send the analytics event by calling the RewardedAdSuggested method before displaying the rewarded video. This is a critical step for maintaining accurate data. When using high-value ads or a custom ad placement ID, specify AdPlacementType.HighValue or AdPlacementType.User as the second parameter, respectively.
To send rewarded ad suggested event, call the following method:
using HomaGames.HomaBelly;
Analytics.RewardedAdSuggested("your ad name");
To check if a rewarded video ad is loaded, call the following method:
HomaBelly.Instance.IsRewardedVideoAdAvailable();
Display the ad only if it is available. To show a rewarded video ad, call the following method:
HomaBelly.Instance.ShowRewardedVideoAd("your ad name");
Note
It is recommended to display the ad loading indicator only after the user has triggered the rewarded video. For instance, in the case of a UI button, keep it interactable even if the rewarded video is not yet loaded. When the player clicks the button, display a loading icon to indicate that they should wait for the ad to show. Ensure the ad is displayed once it is loaded, but only if the player remains in the button's menu.
Explicit placement id
Use this feature only if requested by the project manager. In order to add an additional placement ID to load, call the following method:
using HomaGames.HomaBelly;
HomaBelly.Instance.LoadExtraRewardedVideoAd("placement_id");
Then pass this placement ID to the methods you will be calling. For example, to test if the extra ad ID has been loaded and show it afterwards, call the following methods:
using HomaGames.HomaBelly;
if(HomaBelly.Instance.IsRewardedVideoAdAvailable("placement_id"))
{
HomaBelly.Instance.ShowRewardedVideoAd("your ad name", "placement_id");
}
Rewarded ad callbacks
// Invoked when the video ad is clicked.
Events.onRewardedVideoAdClickedEvent += info => {
};
// Invoked when the RewardedVideo ad view is about to be closed.
Events.onRewardedVideoAdClosedEvent += info => {
};
// Invoked when the user completed the video and should be rewarded.
Events.onRewardedVideoAdRewardedEvent += (reward, info) =>
{
};
// Invoked when the video ad has opened.
Events.onRewardedVideoAdStartedEvent += info => {
};
// Invoked when there is a change in the ad availability status.
Events.onRewardedVideoAvailabilityChangedEvent += (b, info) =>
{
};
// Invoked when the Rewarded Video failed to show
Events.onRewardedVideoAdShowFailedEvent += info => {
};