- Home /
Question by
Rentrax · Oct 30, 2017 at 07:25 PM ·
c#advertising
Unity rewardedvideo ad
Hi I made this script:
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class admanager : MonoBehaviour
{
[SerializeField] string gameID = "xxxxxxxxxx";
void Awake()
{
Advertisement.Initialize (gameID, true);
}
public void ShowAd(string zone = "")
{
#if UNITY_EDITOR
StartCoroutine(WaitForAd ());
#endif
if (string.Equals (zone, "RewardedVideo"))
zone = null;
ShowOptions options = new ShowOptions ();
options.resultCallback = AdCallbackhandler;
if (Advertisement.IsReady (zone))
Advertisement.Show (zone, options);
}
void AdCallbackhandler (ShowResult result)
{
switch(result)
{
case ShowResult.Finished:
siła.sila += 10;
break;
case ShowResult.Skipped:
break;
case ShowResult.Failed:
break;
}
}
void OnMouseDown(){
ShowAd();
}
IEnumerator WaitForAd()
{
float currentTimeScale = Time.timeScale;
Time.timeScale = 0f;
yield return null;
while (Advertisement.isShowing)
yield return null;
Time.timeScale = currentTimeScale;
}
}
I want to have rewarded video ad with no skip option. Is there anyway to do it?
Comment
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Why is Unity Ads not showing an ad in unity 5.2? 5 Answers
Renderer on object disabled after level reload 1 Answer
Unity rewarded ad is not giving reward 0 Answers