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

UNity ads (in windows build) gives error (error CS0246: The type or namespace name `ShowResult' )

$
0
0
So I am intregrating unity ads into my projects. They sort of work with android...sometimes. However when I build the windows 86/64 build, it gives this error. Assets/Plugins/AddCoins.cs(31,39): error CS0246: The type or namespace name `ShowResult' could not be found. Are you missing a using directive or an assembly reference? I am assuming this is not understood by windows. How do I get rid of this error and build for windows? Here is the AddCoins Script. I added some error checking to see what is happening. It's on this line (private void HandleShowResult(ShowResult result). using UnityEngine; using UnityEngine.Advertisements; ///////////////////////////////////////////////////// public class AddCoins : MonoBehaviour { static public bool adReady = false; static public int adState = 0; ///////////////////////////////////////////////////// public void Update() { if (Advertisement.IsReady ("rewardedVideo")) { adReady = true; } else { adReady = false; } } ///////////////////////////////////////////////////// public void ShowRewardedAd() { //////////////////////////////////////////////////// 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("The ad was successfully shown."); adState = 1; CoinsHas.coinsLeft = CoinsHas.coinsLeft + 1; break; case ShowResult.Skipped: Debug.Log("The ad was skipped before reaching the end."); adState = 2; break; case ShowResult.Failed: Debug.LogError("The ad failed to be shown."); adState = 3; break; } //Save Coins ES2.Save (CoinsHas.coinsLeft, "..."); } ///////////////////////////////////////////////////// } /////////////////////////////////////////////////////

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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