Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

Unity Ads doesn't work on the device

$
0
0
I am using the unity Monetization SDK to monetize my game. The videos and banner work in the Editor but when testing on the Device it doesn't work, I already checked if the connection with the project in the dashborad is correct, the IDs are all correct, but I don't know why it doesn't work My code: **The IDs are not XXXXXXX, of course.** using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Advertisements; public class AdsController : MonoBehaviour, IUnityAdsListener { #if UNITY_IOS private string gameId = "XXXXXXX"; #elif UNITY_ANDROID private string gameId = "XXXXXXX"; #endif string rewardedPlacement = "rewardedVideo"; string videoPlacement = "video"; string bannerPlacement = "banner"; public GameController gameController; public Swipe swipeController; public UIAnimation uiAnimation; // Start is called before the first frame update void Start() { Advertisement.AddListener(this); Advertisement.Initialize(gameId, true); } public void ShowVideoAds() { Advertisement.Show(videoPlacement); } public void ShowRewardedAds(string p) { Advertisement.Show(p); } public void ShowBanner() { Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER); Advertisement.Banner.Show(bannerPlacement); } public void OnUnityAdsDidFinish(string placementId, ShowResult showResult) { if(showResult == ShowResult.Finished) { //Rewarded } else if (showResult == ShowResult.Skipped) { // Do not reward the user for skipping the ad. } else if (showResult == ShowResult.Failed) { Debug.LogWarning("The ad did not finish due to an error"); } } }

Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>