I am using Unity Ads rewarded video in my game, it works fine in the editor(displays the everything seems to be working screen). But when I build it to my android device, it does nothing.
Here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Monetization;
public class Advertisements : MonoBehaviour {
private string storeId = "2882757";
private string videoRewarded = "rewardedVideo";
private string video = "video";
private string banner = "bannerAd";
void Start()
{
Monetization.Initialize(storeId, false);
}
public void ShowUnrewardedVideo()
{
if (Monetization.IsReady(video))
{
ShowAdPlacementContent ad = null;
ad = Monetization.GetPlacementContent(video) as ShowAdPlacementContent;
if(ad != null)
{
ad.Show();
}
}
}
public void ShowRewardedVideo(int odulParaMiktari)
{
if (Monetization.IsReady(videoRewarded))
{
ShowAdPlacementContent ad = null;
ad = Monetization.GetPlacementContent(videoRewarded) as ShowAdPlacementContent;
if (ad != null)
{
ad.Show();
GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>().mCoinSayisi += odulParaMiktari;
}
}
}
}
I am calling the ShowRewardedVideo method from another function.