Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Blackscreen when touch an ad and return to app

Discussion in 'Unity Ads & User Acquisition' started by onemoreuser091, Jan 16, 2015.

  1. onemoreuser091

    onemoreuser091

    Joined:
    Nov 15, 2014
    Posts:
    14
    I didn't even know about the blackscreen. I saw that the picture backfill didn't load correctly the icon of the app so I clicked to see if it was working. But when I returned to the app from google play I got the blackscreen. My app was still working because I could press the back button and return.It seems that the ad activity went black when app lost focus or...I can't test enough because it only happens with real ads. But how can I fix this?
    I tried the pause override script from the other threads with similar problems but no luck.
     
  2. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    235
    Hello,

    You should send some logs or your ad script to get help faster.

    Regards,
     
  3. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    This could be an issue of the app not resuming properly after being paused when the ad is shown.

    Check out this forum post and let me know if the solution works for you.

    If it doesn't work, find the PauseGame() and ResumeGame() methods in the Engine.cs script included with the Unity Ads asset package. Comment out the contents of each method and try again.
     
  4. onemoreuser091

    onemoreuser091

    Joined:
    Nov 15, 2014
    Posts:
    14
    I still get the black screen. Touching the screen while I have a black screen will show the ad or start google play again.
    I don't see a black screen when I press recent or home button and return to the app only after touching the add. Also the logs aren't showing nothing different when it works correctly or I get the black screen.

    The only thing I can do right now is to close the ad when app is resumed though this is not a very good solution...Or I don't know if there is way to refresh current view?
     
  5. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Can you share an example of your implementation code? Also, what device are you testing on? Which version of Unity are you building with? What version of the Unity Ads asset package are you using?
     
  6. onemoreuser091

    onemoreuser091

    Joined:
    Nov 15, 2014
    Posts:
    14
    Ad initialization script(I have this in an earlier scene than the others scripts)
    Code (CSharp):
    1.     public string gameId;
    2.     public bool testMode;
    3.  
    4.     void Start (){
    5.       Advertisement.allowPrecache = true;
    6.       Advertisement.Initialize(gameId,testMode);
    7. }
    8. }
    To show an ad at start of the app:
    Code (CSharp):
    1.  IEnumerator Start()
    2.   yield return new WaitForSeconds(0.75f);
    3.   do yield return null;
    4.   while (!Advertisement.isInitialized);
    5.   do yield return null;
    6.   while (!Advertisement.isReady(zoneId));
    7.   Advertisement.Show(zoneId);
    In the menu, I have this start code and call ShowAd() when I want to show more ads(pause or loading scene.)
    Code (CSharp):
    1.     public float Start = 90;
    2.     public float Repeat = 300;
    3.     public string zoneId;
    4.  
    5.         void Start ()
    6.         {
    7.           InvokeRepeating("ShowAd",Start,Repeat);
    8.  
    9.         }
    10.  
    11.     public void ShowAd() {
    12.       if(Advertisement.isReady(zoneId)){
    13.          Advertisement.Show(zoneId);
    14.         }
    15.     }
    16. }
    17.  
    Unity version:4.6.1p4. But I think it happened with 4.6.0 too.
    Ads version:I think I have the latest version even if it says 20 january there is nothing new.
    Device: Htc One Sv,Samsung Galaxy S4 and a Szenio tablet same problem in all.
    Also, sometimes it loads and works correctly but very few times.
     
    Last edited: Jan 21, 2015