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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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); } } } |