Wow. That was easier than I expected. I signed up in the services section of Unity, turned on “test mode”. Then created a button and added the following 2 scripts to said button and it worked like a charm 🙂
This code shows the rewarded ad types. Video ads that the player chooses to watch and will be rewarded if they are seen to the end.
using UnityEngine; using UnityEngine.Advertisements; public class UnityAdsInitializer : MonoBehaviour {    [SerializeField]    private string        androidGameId = "Number Found In Services->Settings->Advanced",        iosGameId = "Number Found In Services->Settings->Advanced";    [SerializeField]    private bool testMode;    void Start() {        string gameId = null; #if UNITY_ANDROID        gameId = androidGameId; #elif UNITY_IOS        gameId = iosGameId; #endif        if (Advertisement.isSupported && !Advertisement.isInitialized) {            Advertisement.Initialize(gameId, testMode);        }    } }
using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.Advertisements; public class WatchAd : MonoBehaviour { Â Â Â [SerializeField] Â Â Â private string placementId = null; Â Â Â private Button _button; Â Â Â void Start() { Â Â Â Â Â Â Â _button = GetComponent<Button>(); Â Â Â Â Â Â Â if (_button) { Â Â Â Â Â Â Â Â Â Â Â _button.interactable = false; Â Â Â Â Â Â Â Â Â Â Â _button.onClick.AddListener(ShowAd); Â Â Â Â Â Â Â } Â Â Â } Â Â Â void Update() { Â Â Â Â Â Â Â if (_button == null) return; Â Â Â Â Â Â Â _button.interactable = ( Â Â Â Â Â Â Â Â Â Â Â Advertisement.isInitialized && Â Â Â Â Â Â Â Â Â Â Â Advertisement.IsReady(placementId) Â Â Â Â Â Â Â ); Â Â Â } Â Â Â public void ShowAd() { Â Â Â Â Â Â Â var options = new ShowOptions { resultCallback = HandleShowResult }; Â Â Â Â Â Â Â Advertisement.Show(placementId, options); Â Â Â } Â Â Â private void HandleShowResult(ShowResult result) { Â Â Â Â Â Â Â switch (result) { Â Â Â Â Â Â Â Â Â Â Â case ShowResult.Finished: Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Debug.Log("The ad was successfully shown."); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // YOUR CODE TO REWARD THE GAMER Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // Give coins etc. Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; Â Â Â Â Â Â Â Â Â Â Â case ShowResult.Skipped: Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Debug.Log("The ad was skipped before reaching the end."); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; Â Â Â Â Â Â Â Â Â Â Â case ShowResult.Failed: Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Debug.LogError("The ad failed to be shown."); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; Â Â Â Â Â Â Â } Â Â Â } }
I’m now hoping that in-app purchases will be this simple (although I doubt it).