i have placed ads in my game to get items but it doesn't seem to work on my phone while it does work in the editor
i've searched arround on the internet but couldn't find anything useful
i hope someone can help...
ad script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;
public class ad2 : MonoBehaviour {
public GameObject Error;
public float Bonuskaas;
public Text bonusdisplay;
void Start() {
Advertisement.Initialize ("GameID", false);
}
void Update() {
Bonuskaas = kaasHandler.kps * 60 * 10;
bonusdisplay.GetComponent ().text = "+ " + Bonuskaas;
}
public void ButtonClicked() {
if (Advertisement.IsReady("rewardedVideo")) {
var options = new ShowOptions { resultCallback = HandleShowResult };
Advertisement.Show ("rewardedVideo", options);
}
}
private void HandleShowResult(ShowResult result) {
switch (result) {
case ShowResult.Finished:
Debug.Log ("ad finished");
Click.kaas += Bonuskaas;
break;
case ShowResult.Skipped:
Debug.Log ("ad was skipped");
break;
case ShowResult.Failed:
Debug.Log ("ad failed to be shown");
Error.SetActive (true);
break;
}
}
}
it doesn't show me my error gameobject either btw
↧