Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'googlemobileads'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. Hi guys. I've a problem with rewarding player. Everything in the script are working / showing expect rewarding player (when a player watch a rewarded video till the end) reward videos are showing... banners are showing... Interstitial videos are showing. but rewarding player is not working -.- here's the script .. Scroll down till you find "HandlerOnAdRewarded" using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds; using GoogleMobileAds.Api; public class Ad_Manager : MonoBehaviour { public enum Progression {gold, diamond, tryforfree}; public Progression progression; public string bannerid = "BANNER-ID"; public string videoid = "VIDEO_ID"; public string rewardedvideoid1 = "REWARD-VIDEO-ID-1"; public string rewardedvideoid2 = "REWARD-VIDEO-ID-2"; public string rewardedvideoid3 = "REWARD-VIDEO-ID-3"; public static Ad_Manager Instance{ set; get;} public string rewardedID1,rewardedID2,rewardedID3; public GameObject failOBJ; private BannerView bannerView; private RewardBasedVideoAd rewardView; public bool rewardedLoaded,adShowed; private InterstitialAd interstitial; private void Start() { Instance = this; DontDestroyOnLoad (gameObject); RequestInterstitial(); rewardView = RewardBasedVideoAd.Instance; rewardView.OnAdClosed += HandlerOnAdClosed; rewardView.OnAdFailedToLoad += HandlerOnAdFailedToLoad; rewardView.OnAdLoaded += HandlerOnAdLoaded; rewardView.OnAdRewarded += HandlerOnAdRewarded; Debug.Log ("Admanger in start"); LoadReward (); } private void LoadReward() { if (rewardView.IsLoaded ()==false) { rewardView.LoadAd (new AdRequest.Builder ().Build (), rewardedID1); rewardView.LoadAd (new AdRequest.Builder ().Build (), rewardedID2); rewardView.LoadAd (new AdRequest.Builder ().Build (), rewardedID3); Debug.Log ("Loading ad.."); } } public void ShowRewardAd() { if (rewardView.IsLoaded ()) { Debug.Log ("playing ad"); rewardView.Show (); } else { rewardView.LoadAd (new AdRequest.Builder ().Build (), rewardedID1); rewardView.LoadAd (new AdRequest.Builder ().Build (), rewardedID2); rewardView.LoadAd (new AdRequest.Builder ().Build (), rewardedID3); Debug.Log ("Loading ad.."); failOBJ.SetActive (true); } Debug.Log ("playing ad : "+ rewardView.IsLoaded ()); } public void HandlerOnAdLoaded(object sender,EventArgs args) { rewardedLoaded = true; Debug.Log ("ad loaded"); } public void HandlerOnAdFailedToLoad(object sender,AdFailedToLoadEventArgs args) { Debug.Log ("Filed Loading Ad : " + args.Message ); LoadReward (); } public void HandlerOnAdClosed(object sender,EventArgs args) { adShowed = false; } public void HandlerOnAdRewarded(object sender,Reward args) { if (progression == Progression.gold) { args.Amount = 10; UEncryptPrefs.SetInt ("COINS", args); } if (progression == Progression.diamond) { args.Amount = 1; UEncryptPrefs.SetInt ("DIAMONDS", args); } } private void RequestInterstitial() { #if UNITY_ANDROID string adUnitId1 = "ca-app-pub-9131922840133006/9021770373"; string adUnitId2 = "ca-app-pub-9131922840133006/7545037179"; #elif UNITY_IPHONE string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE"; #else string adUnitId = "unexpected_platform"; #endif // Initialize an InterstitialAd. interstitial = new InterstitialAd(adUnitId1); interstitial = new InterstitialAd(adUnitId2); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the interstitial with the request. interstitial.LoadAd(request); } public void ShowIntersitital() { if (!UEncryptPrefs.HasKey ("NO_ADVERTISEMENTS")) { if (interstitial.IsLoaded()) { interstitial.Show(); } else { print ("Ad is not ready to show yet."); } } } }
×
×
  • Create New...