Hi guys, today I've been trying to add ads to my unity game using unity ads. So far, I've followed a tutorial that when I press a button it calls a script that lets the user watch a video and gets rewarded for it. However, it is not working! I am using unity 5.5. Any ideas how i could solve this. Thanks in advance!
`using UnityEngine;
using UnityEngine.Advertisements;
using System.Collections;
public class Ads : MonoBehaviour
{
private void Start()
{
}
public void ShowAd()
{
%|601152482_6|%
{
Debug.Log ("Working ad");
Advertisement.Show ("rewardedVideo", new ShowOptions(){resultCallback = HandleAdResult});
}
}
private void HandleAdResult(ShowResult result)
{
switch (result)
%|1766910098_15|%
case ShowResult.Finished:
Debug.LogFormat ("Player gains 50 gold");
break;
case ShowResult.Skipped:
Debug.Log("Player didnt watch the ad");
break;
case ShowResult.Failed:
Debug.Log ("interent? player didnt watch ad.");
break;
}
%|628240893_26|%
}
`
↧