Search Unity

Ads with locked portrait orientation

Discussion in 'Unity Ads & User Acquisition' started by Miguel-Ferreira, Nov 13, 2015.

  1. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    I'm having some trouble displaying ads when the game is in portrait mode and the orientation is locked.

    When I start the game I conditionally lock the device's orientation depending on the device, because on IPhone's auto rotation doesn't make sense for our game but on IPads it does.

    The thing is that, after locking the orientation to portrait (through Screen.autorotateToLandscapeLeft = false;
    and Screen.autorotateToLandscapeRight = false
    ) the next time I try to show a ad (through Advertisement.Show()), nothing is displayed and I get the following warning on XCode logs

    Warning: Attempt to present <UnityAdsMainViewController: 0x13fa6a850> on <UnityDefaultViewController: 0x13f863fb0> whose view is not in the window hierarchy!


    What is the proper way to handle video ads and orientation conditional-locking? By the way, I've turned on the "Change video orientation according to device (forced to landscape by default)" on the ads admin page