Search Unity

ads wont display after a change in orientation

Discussion in 'Unity Ads & User Acquisition' started by lightbreak, May 5, 2016.

  1. lightbreak

    lightbreak

    Joined:
    May 24, 2014
    Posts:
    5
    We have an app that changes its orientation depending on certain parts of the game, we noticed that when after changing the resolution, ads wont display.

    this is the error we got

    2016-05-06 04:00:04.239 game[4343:1035365] Warning: Attempt to present <UnityAdsMainViewController: 0x1582db050> on <UnityDefaultViewController: 0x15817cd60> whose view is not in the window hierarchy!

    really would appreciate the help.

    were using version 5.2.2 and the ads found in services
     
  2. DuckehLabs

    DuckehLabs

    Joined:
    Nov 30, 2015
    Posts:
    3
    I'm getting the same error. I don't change the orientation, but I do load the game in a landscape orientation.

    The code for showing ads in my game is very simple,

    public void ShowAd()
    {
    print ("SHOW AD");
    if (Advertisement.IsReady())
    {
    print ("SHOWING AD");
    Advertisement.Show();
    }
    }
    }

    gets called every X deaths. The ads display fine in the editor.
     
  3. Mikea15

    Mikea15

    Joined:
    Sep 20, 2012
    Posts:
    93
    I have the same warning, and still am waiting for some answers from Unity.. :/ I change orientations in code, but either way, it doesn't display ads. iOS only error.

    Edit: I was able to display ads as soon as I removed the screen.orientation code.
     
    Last edited: May 9, 2016
    unity-nikkolai likes this.
  4. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    365
    This issue has been brought to the attention of the developers.

    It only affects iOS and occurs when you change screen orientation from code.

    It will be addressed in a future release, but for the time being - avoid changing screen orientation from the code.

    Apologies for any inconvenience caused by this.
     
    unity-nikkolai likes this.
  5. DuckehLabs

    DuckehLabs

    Joined:
    Nov 30, 2015
    Posts:
    3
    Found that I was indeed changing the orientation via code as well as the settings, removed that and ads are working as expected. Thanks.
     
    unity-nikkolai likes this.