Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
2
Question by ecgarciajr · Feb 07, 2015 at 11:16 AM · iosscreenorientation

How do I fix the orientation when game exits and enters the background (iOS)? (Updated)

Game I wrote is limited to Autorotate in Landscape only (through Unity Player Settings - Unity 4.6.2). After successful build in XCode 6.1.1 (testing on iPhone 5), the game plays correctly in correct orientation. Problem occurs when game is exited and enters the background. The orientation changes to Portrait-UpsideDown. Is there a Unity setting I'm missing? How can I fix this? I've searched on the Unity Forum, Stackoverflow and many other game forums but I can't find anything remotely close to this problem. Anyone ever have this problem? How did you solve it? Thanks...

alt text

Edit: I narrowed the problem to the iAds code taken from the Unity docs (http://docs.unity3d.com/ScriptReference/ADBannerView.html). First I created an empty splash screen with just an image on it. I did a build through Unity(4.6.2), compiled it in Xcode (6.1.1) and loaded it on my iPhone 5 (iOS 8.1.3). The screen orientations were correct and when it entered the background, the orientation was correct (LandscapeLeft). Afterwards, I added an empty game object with just the iADs code to it. I built it, compiled it and loaded it to my iPhone. The orientation upon applicationDidEnterBackground was rotated to the left, thereby making it look like it was upside down. I repeated both tests several times to make sure it wasn't just a fluke, but the results were the same each time (correct exit rotation without the iAds code, incorrect with iAds included). Is this a bug with UNITY or with Xcode? Below is my code for the iADs. Any thoughts?

 using UnityEngine;
 using System.Collections;
 
 public class iAds : MonoBehaviour {
 
     public ADBannerView banner = null;
 
     void Start()
     {
         banner = new ADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.Bottom);
         ADBannerView.onBannerWasClicked += OnBannerClicked;
         ADBannerView.onBannerWasLoaded  += OnBannerLoaded;
     }
     
     void OnBannerClicked()
     {
         Debug.Log("Clicked!\n");
     }
     
     void OnBannerLoaded()
     {
         banner.visible = true;
     }
 }

screen-shot-upsidedown.png (314.8 kB)
Comment
Add comment · Show 5
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
avatar image warrior1988 · Jul 23, 2015 at 11:00 AM 0
Share

hi i am also facing the same issue. did you find any fix for this problem?

avatar image ecgarciajr · Jul 23, 2015 at 05:39 PM 0
Share

No, I was not able to find a fix for this problem. I submitted a bug report to Unity but they never replied. I ended up removing the iAds code and used Admob coding ins$$anonymous$$d.

avatar image celestis · Sep 12, 2015 at 10:30 AM 0
Share

Experiencing the same trouble. Not quite willing to abandon iAds... Are there any updates on this issue?

avatar image ecgarciajr · Sep 14, 2015 at 09:51 PM 0
Share

@celestis - Sorry, I completely removed the iAds code from my game because of this issue. No one from Unity ever replied to my bug report. I moved over to Admob codes in my game.

avatar image celestis ecgarciajr · Sep 15, 2015 at 07:17 AM 0
Share

I see. Well, that's sad, thanks for reply anyway. I made a sort of workaround: in OnApplicationPause I show a premade overlay with a pause sign. This helps a bit, at least the app doesn't look that ugly now.

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Screen.orientation absolutely fails to respond 0 Answers

iPad Screen Orientation 2 Answers

iOS - Smooth auto-rotation of orientation 1 Answer

iPhoneKeyboard.autorotate to device orientation not working? 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