Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by DRIVER1ksa · Dec 17, 2015 at 04:50 PM · unity 4.6

error CS1502: The best overloaded method match

How can i fix this error? this error shows up when i want to building game apk

1# (161,41): error CS1502: The best overloaded method match for AndroidVideoAdsManager.RequestVideoAd(System.Action)' has some invalid arguments 2# (161,41): error CS1503: Argument #1' cannot convert System.Action<bool>' expression to type System.Action'

 using UnityEngine;
 using SBS.Core;
 using SBS.Miniclip;
 using System;
 using System.Collections;
 
 public class OnTheRunCoinsService : Manager<OnTheRunCoinsService>
 {
     #region Singleton instance
     protected static OnTheRunCoinsService instance = null;
 
     public static OnTheRunCoinsService Instance
     {
         get
         {
             return Manager<OnTheRunCoinsService>.Get();
         }
     }
     #endregion
 
     const bool LOGS_ARE_ENABLED = false;
 
     public const int EDITOR_FREE_COINS_REWARD = 100;
 
     public enum WatchVideoPlacement
     {
         MainMenuVideoAdsPlacement,
         IncentivisePopupVideoAdsPlacement,
         NotEnoughCoinsVideoAdsPlacement,
         ShopCoinsVideoAdsPlacement,
         SaveMeAdsPlacement
     }
 
     public enum VideoType
     {
         FreeCoins,
         SaveMe,
         Booster,
         FreeFuel
     }
 
     Action<bool> coinsRewardCallback;
 
     bool videoAdsAreEnabled;
     int coinsRewardPerVideo;
     int maxVideosPerDay;
     int maxBoosterVideosPerDay;
     int maxFreeFuelVideosPerDay;
     int maxFreeSaveMeVideosPerDay;
 
     bool Videos_ReachedMaxPerDay { get { return OnTheRunDaysCounterForAdvertising.Instance.VideosShownToday >= maxVideosPerDay; } }
     bool BoosterVideos_ReachedMaxPerDay { get { return OnTheRunDaysCounterForAdvertising.Instance.BoosterVideosShownToday >= maxBoosterVideosPerDay; } }
     bool FreeFuelVideos_ReachedMaxPerDay { get { return OnTheRunDaysCounterForAdvertising.Instance.FreeFuelVideosShownToday >= maxFreeFuelVideosPerDay; } }
     bool FreeSaveMeVideos_ReachedMaxPerDay { get { return OnTheRunDaysCounterForAdvertising.Instance.FreeSaveMeVideosShownToday >= maxFreeSaveMeVideosPerDay; } }
     
     int TodaysRemainingVideos { get { return maxVideosPerDay - OnTheRunDaysCounterForAdvertising.Instance.VideosShownToday; } }
 
     public int FreeCoinsReward { get { return coinsRewardPerVideo; } }
 
     #region Initialization Methods
 
     new void Awake()
     {
         base.Awake();
         DontDestroyOnLoad(gameObject);
         
         Init();
     }
         
     void Init()
     {
         Log("Init");
 
 #if UNITY_IPHONE
 #    if MC_COINS_SERVICE
         CoinsServiceBindings.Start();
         ObjCDispatcher.Instance.RegisterEvent("csReward", onCoinsServiceReward);
         ObjCDispatcher.Instance.RegisterEvent("csCloseNoReward", onCoinsServiceCloseWithoutReward);
         ObjCDispatcher.Instance.RegisterEvent("csDisableSound", (str) => { AudioListener.volume = 0.0f; });
         ObjCDispatcher.Instance.RegisterEvent("csEnableSound", (str) => { AudioListener.volume = 1.0f; });
 #   endif
 #elif UNITY_ANDROID
         gameObject.AddComponent<AndroidVideoAdsManager>();
 #endif
     }
 
     public void SetConfigParameters(bool _videoAdsAreEnabled, int _coinsRewardPerVideo, int _maxVideosPerDay, int _maxBoosterVideosPerDay, int _maxFreeFuelVideosPerDay, int _maxFreeSaveMeVideosPerDay)
     {
         Log("SetConfigParameters - videosEnabled: " + _videoAdsAreEnabled + " - coinsReward: " + _coinsRewardPerVideo + " - maxVideos/Day: " + _maxVideosPerDay + " - maxBooster/Day: " + _maxBoosterVideosPerDay + " - maxFreeFuel/Day: " + _maxFreeFuelVideosPerDay + " - maxFreeSaveMe/Day: " + _maxFreeSaveMeVideosPerDay);
 
         this.videoAdsAreEnabled = _videoAdsAreEnabled;
         this.coinsRewardPerVideo = _coinsRewardPerVideo;
         this.maxVideosPerDay = _maxVideosPerDay;
         this.maxBoosterVideosPerDay = _maxBoosterVideosPerDay;
         this.maxFreeFuelVideosPerDay = _maxFreeFuelVideosPerDay;
         this.maxFreeSaveMeVideosPerDay = _maxFreeSaveMeVideosPerDay;
     }
 
     public void OnTranslationsReady()
     {
         Log("Translations Ready");
 
         //LOCALIZATION
         
 #if UNITY_IPHONE && MC_COINS_SERVICE
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.TitleCongratulations,            ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_congrat")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.TitleSorry,                      ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_sorry")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.MessageWatchMore,                ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_another_video")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.MessageCurrentlyNoMoreAvailable, ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_not_available")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.MessageCurrentlyNotAvailable,    ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_not_available")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.ButtonLater,                     ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_later")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.ButtonWatchNow,                  ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_watch_now")));
         CoinsServiceBindings.SetDialogLocalizedText(CoinsServiceBindings.SystemDialogTextType.ButtonOk,                        ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_ok")));
 #endif
     }
 
     public string ReplaceCoinsSymbolWithValue(string str)
     {
         const string coins_symbol = "$coins$";
         return str.Replace(coins_symbol, coinsRewardPerVideo.ToString());
     }
 
     #endregion
 
     #region Video Request Public Methods
 
     public void OnFreeCoinsSelected()
     {
         Log("OnFreeCoinsSelected");
 
         coinsRewardCallback = FreeCoinsRewardCallback;
 
 #if UNITY_EDITOR
         onCoinsServiceReward(string.Empty);
 #elif UNITY_IPHONE
 #    if MC_COINS_SERVICE
         CoinsServiceBindings.Show_withDialogAtEnd(TodaysRemainingVideos);
 #    else
         OnTheRunFyberManager.Instance.LaunchRewardedVideo(coinsRewardCallback);
 #    endif
 #elif UNITY_ANDROID
         AndroidVideoAdsManager.Instance.RequestVideoAd(() => { FreeCoinsRewardCallback(true); });
 #endif
     }
 
     public void WatchVideoForCallback(Action<bool> callback)
     {
         Log("OnWatchVideoForCallback");
 
         coinsRewardCallback = callback;
 
 #if UNITY_EDITOR
         onCoinsServiceReward(string.Empty);
 #elif UNITY_IPHONE
 #    if MC_COINS_SERVICE
         CoinsServiceBindings.Show_noDialogAtEnd();
 #    else
         OnTheRunFyberManager.Instance.LaunchRewardedVideo(callback);
 #    endif
 #elif UNITY_ANDROID
         AndroidVideoAdsManager.Instance.RequestVideoAd(callback);
 #endif
     }
 
     #endregion
 
     #region Reward Callback Methods
 
     void onCoinsServiceReward(string param)
     {
         Log("onCoinsServiceReward - param: " + param);
 
         if (coinsRewardCallback != null)
             coinsRewardCallback(true);
     }
 
     void onCoinsServiceCloseWithoutReward(string param)
     {
         Log("onCoinsServiceCloseWithoutReward - param: " + param);
 
         if (coinsRewardCallback != null)
             coinsRewardCallback(false);
     }
 
     void FreeCoinsRewardCallback(bool success)
     {
         Log("FreeCoinsRewardCallback - success: " + success);
 
         if (success)
         {
             PlayerPersistentData.Instance.IncrementCurrency(PriceData.CurrencyType.FirstCurrency, coinsRewardPerVideo);
             Manager<UIRoot>.Get().UpdateCurrenciesItem();
 
 #if UNITY_ANDROID
             AndroidVideoAdsManager.Instance.NotifyCoinsReward();
 #endif
             OnTheRunDaysCounterForAdvertising.Instance.OnVideoAdShown(VideoType.FreeCoins);
         }
 
 #if UNITY_IPHONE
         TriggerFreeCoinsAlertDialog(success);
 #endif
     }
 
     #endregion
 
     #region iOS Free Coins Feedback Alert
     
 #if UNITY_IPHONE
 
     string freeCoinsDialog_congrats = string.Empty;
     string freeCoinsDialog_sorry = string.Empty;
 
     string freeCoinsDialog_watchMore = string.Empty;
     string freeCoinsDialog_noMoreAvailable = string.Empty;
 
     string freeCoinsDialog_buttonLater = string.Empty;
     string freeCoinsDialog_buttonWatchNow = string.Empty;
     string freeCoinsDialog_buttonOk = string.Empty;
 
     void TriggerFreeCoinsAlertDialog(bool success)
     {
         FreeCoinsDialogLazySetup();
 
         if (success)
             StartCoroutine(DelayedFreeCoinsAlertDialog());
     }
 
     IEnumerator DelayedFreeCoinsAlertDialog()
     {
         const float MAX_SECONDS_DELAY = 5.0f;
 
         Manager<UIRoot>.Get().ShowLoadingPopup();
 
         yield return new WaitForEndOfFrame();
         OnTheRunFyberManager.Instance.CacheRewardedVideo();
 
         float timeBefore = TimeManager.Instance.MasterSource.TotalTime;
         
         //Debug.Log ("--- --- --- ------------- DelayedFreeCoinsAlertDialog - start");
 
         while (TimeManager.Instance.MasterSource.TotalTime - timeBefore < MAX_SECONDS_DELAY)
         {
             //Debug.Log ("--- --- --- ------------- DelayedFreeCoinsAlertDialog - waiting - elapsed: " + (TimeManager.Instance.MasterSource.TotalTime - timeBefore).ToString());
             if (OnTheRunFyberManager.Instance.VideoRequestResponseIsReceived)
             {
                 //Debug.Log ("--- --- --- ------------- DelayedFreeCoinsAlertDialog - VideoRequestResponseIsReceived - stopping coroutine");
                 ShowFreeCoinsAlertView();
                 yield break;
             }
 
             yield return new WaitForEndOfFrame();
         }
         
         //Debug.Log ("--- --- --- ------------- DelayedFreeCoinsAlertDialog - time is up - calling ShowFreeCoinsAlertView");
         ShowFreeCoinsAlertView();
     }
 
     void ShowFreeCoinsAlertView()
     {
         //Debug.Log ("--- --- --- ------------- ShowFreeCoinsAlertView - IsVideoAdAvailable: " + IsVideoAdAvailable());
         //Debug.Log ("--- --- --- ------------- ShowFreeCoinsAlertView - flag details - videoAdsAreEnabled: " + videoAdsAreEnabled + " - AreServiceVideoAdsAvailable: " + AreServiceVideoAdsAvailable () + " -  Videos_ReachedMaxPerDay: " + Videos_ReachedMaxPerDay);
         //ObjCDispatcher.Instance.RegisterEvent("alertButtonClicked", onFreeCoinsAlertDialogClicked);
 
         Manager<UIRoot>.Get().HideLoadingPopup();
 
         var uiMan = UIManager.Instance;
         uiMan.PushPopup("VideoFeedbackPopup");
         if (IsVideoAdAvailable())
         {    //SBS.Miniclip.AlertViewBindings.AlertBox(freeCoinsDialog_congrats, freeCoinsDialog_watchMore, freeCoinsDialog_buttonWatchNow, new string[] { freeCoinsDialog_buttonLater });
                 
             //uiMan.FrontPopup.GetComponent<UIVideoFeedbackPopup>().SetupPopup(2, ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_congrat")), ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_another_video")));
             uiMan.FrontPopup.GetComponent<UIVideoFeedbackPopup>().SetupPopup(2, freeCoinsDialog_congrats, freeCoinsDialog_watchMore);
         }
         else
         {
             //SBS.Miniclip.AlertViewBindings.AlertBox(freeCoinsDialog_congrats, freeCoinsDialog_noMoreAvailable, freeCoinsDialog_buttonOk);
             //uiMan.FrontPopup.GetComponent<UIVideoFeedbackPopup>().SetupPopup(1, ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_sorry")), ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_sorry")));
             uiMan.FrontPopup.GetComponent<UIVideoFeedbackPopup>().SetupPopup(1, freeCoinsDialog_congrats, freeCoinsDialog_noMoreAvailable);
         }
     }
 
     void FreeCoinsDialogLazySetup()
     {
         if (string.IsNullOrEmpty(freeCoinsDialog_congrats))
             freeCoinsDialog_congrats = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_congrat"));
 
         if (string.IsNullOrEmpty(freeCoinsDialog_sorry))
             freeCoinsDialog_sorry = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_sorry"));
 
         if (string.IsNullOrEmpty(freeCoinsDialog_watchMore))
             freeCoinsDialog_watchMore = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_another_video"));
 
         if (string.IsNullOrEmpty(freeCoinsDialog_noMoreAvailable))
             freeCoinsDialog_noMoreAvailable = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_not_available"));
 
         if (string.IsNullOrEmpty(freeCoinsDialog_buttonLater))
             freeCoinsDialog_buttonLater = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_later"));
 
         if (string.IsNullOrEmpty(freeCoinsDialog_buttonWatchNow))
             freeCoinsDialog_buttonWatchNow = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_watch_now"));
 
         if (string.IsNullOrEmpty(freeCoinsDialog_buttonOk))
             freeCoinsDialog_buttonOk = ReplaceCoinsSymbolWithValue(OnTheRunDataLoader.Instance.GetLocaleString("popup_free_coins_ok"));
     }
 
     /*void onFreeCoinsAlertDialogClicked(string pressedButton)
     {
         ObjCDispatcher.Instance.RemoveEvent("alertButtonClicked");
 
         if (pressedButton.Equals(freeCoinsDialog_buttonWatchNow))
             StartCoroutine(DelayedWatchOneMoreVideo());
     }
 
     IEnumerator DelayedWatchOneMoreVideo()
     {
         for (int i = 0; i < 3; i++)
             yield return new WaitForEndOfFrame();
         
         OnTheRunFyberManager.Instance.LaunchRewardedVideo(FreeCoinsRewardCallback);
     }*/
 #endif
     #endregion
 
     #region Videos Availability Check Methods
 
     bool AreServiceVideoAdsAvailable()
     {
 #if UNITY_WP8 || UNITY_WEBPLAYER || UNITY_WEBGL
         return false;
 #elif UNITY_EDITOR
         return true;
 /*
 #    if MC_COINS_SERVICE
         return true;
 #   else
         return OnTheRunFyberManager.Instance.VideoIsReady;
 #   endif
 */
 #elif UNITY_IPHONE
 #    if MC_COINS_SERVICE
         return CoinsServiceBindings.AreVideoAdsAvailable();
 #   else
         return OnTheRunFyberManager.Instance.VideoIsReady;
 #   endif
 #elif UNITY_ANDROID
         AndroidVideoAdsManager.Instance.AreVideoAdsAvailable();
 #endif
         return false;
     }
 
     public bool IsVideoAdAvailable()
     {
         return videoAdsAreEnabled && AreServiceVideoAdsAvailable() && !Videos_ReachedMaxPerDay;
     }
 
     public bool IsBoosterVideoAvailable()
     {
         return IsVideoAdAvailable() && !BoosterVideos_ReachedMaxPerDay;
     }
 
     public bool IsFreeFuelVideoAvailable()
     {
         return IsVideoAdAvailable() && !FreeFuelVideos_ReachedMaxPerDay;
     }
 
     public bool IsFreeSaveMeVideoAvailable()
     {
         return IsVideoAdAvailable() && !FreeSaveMeVideos_ReachedMaxPerDay;
     }
     #endregion
 
     void Log(string logStr)
     {
         if (LOGS_ARE_ENABLED)
             Debug.Log("### Coins Service Manager - " + logStr);
     }
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by NoseKills · Dec 17, 2015 at 11:05 PM

Sounds like AndroidVideoAdsManager.Instance.RequestVideoAd(callback); doesn't want a callback with a bool parameter (Action ). It wants a callback without parameters ( Action ).

cannot convert System.Action<bool>' expression to type System.Action

you could do for example something like

 AndroidVideoAdsManager.Instance.RequestVideoAd(() => callback(false));

So declare an anonymous function that calls callback with a either true or false every time. You choose which

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Why Resources.Load does not works in Build? 1 Answer

Refer same position using 2 cameras with different orthosize 0 Answers

How do I stop my timer by accessing a variable from another script? 2 Answers

Failed to sign APK package when connection with Android settings (Unity 2018.2) 0 Answers

How do I manually uninstall Unity WITHOUT using add/remove program? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges