Search Unity

Bug sometimes in showresult.finished:

Discussion in 'Unity Ads & User Acquisition' started by IndieFist, Jul 17, 2019.

  1. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    Hi, i would paste the official code for unity ads i was using, because sometimes i can see debug when a video its completed but the function isn´t called, i have put one line also in my function but still the same problem.
    I can´t errors in my console.

    Code (CSharp):
    1.   private void QuestVideo(ShowResult resultc)
    2.         {
    3.             switch (resultc)
    4.             {
    5.                 case ShowResult.Finished:
    6.                     QuitoControl();
    7.                     Debug.Log("completo");
    8.                     break;
    9.                 case ShowResult.Skipped:
    10.                     QuitoControl();
    11.                     break;
    12.                 case ShowResult.Failed:
    13.                     QuitoControl();
    14.                     break;
    15.             }
    16.         }
    17.  
    18. void QuitoControl(){
    19. Debug.Log("Completed Reward system");
    20. }
    21.  
    22.  
    23.         public void ShowAdsQuest()
    24.         {
    25.             if (Advertisement.IsReady("questVideo"))
    26.             {
    27.                 MuestraControl();
    28.                 var options = new ShowOptions { resultCallback = QuestVideo };
    29.                 Advertisement.Show("questVideo", options);
    30.             }
    31.         }
    Sometimes "QuitoControl" isn´t launched and completed debug is fine:
    Debug.Log("Completed Reward system");

    Whant more can i debug?

    And sometimes, i use the same callback for different callbacks, its that ok?
    Code (CSharp):
    1. public void ShowNoAds()
    2.         {
    3.             Debug.Log("Sacando videos");
    4.             if (Advertisement.IsReady("video"))
    5.             {
    6.                     MuestraControl();
    7.                 var options = new ShowOptions { resultCallback = CosaDada };
    8.                 Advertisement.Show("video", options);
    9.             }
    10.  
    11.         }
    12.  
    13.         public void ShowAnyAd()
    14.         {
    15. //            Debug.Log("Sacando videos");
    16.             if (Advertisement.IsReady("video"))
    17.             {
    18.                 MuestraControl();
    19.                 var options = new ShowOptions { resultCallback = CosaDada };
    20.                 Advertisement.Show("video", options);
    21.             }
    22.  
    23.         }
    24.  
    25.         private void CosaDada(ShowResult resultb)
    26.         {
    27.             switch (resultb)
    28.             {
    29.                 case ShowResult.Finished:
    30.                         QuitoControl();
    31.                     break;
    32.                 case ShowResult.Skipped:
    33.                         QuitoControl();
    34.                         break;
    35.                 case ShowResult.Failed:
    36.                         QuitoControl();
    37.                         break;
    38.             }
    39.         }
    40.  
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Could you clarify the issue you are having? If you see the debug message, that means that method is getting called.

    If you are having trouble tracking which methods are called when, you should add a debug statement as the first line of all methods, to show when they are getting called.

    It doesn't look like there is any different between the ShowNoAds method and ShowAnyAd method, so I don't know why you would have both.