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
7
Question by DreamEnder · Mar 08, 2013 at 11:54 AM · autorotatescreen.orientation

Manually setting Screen.orientation breaks AutoRotate

I have 2 scenes. The first rotates between portrait up and down. The second should rotate between the 2 landscape orientations. When I change scenes I call this code:

 Screen.orientation = ScreenOrientation.LandscapeLeft; // This line breaks Auto Rotation
         
 Screen.autorotateToLandscapeLeft = true;
 Screen.autorotateToLandscapeRight = true;
 Screen.autorotateToPortrait = false;
 Screen.autorotateToPortraitUpsideDown = false;

If I set the screen orientation to be landscape left the scene does not rotate anymore when I flip the device.

Comment
Add comment · Show 4
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 kennyd-itp · Oct 07, 2014 at 01:43 PM 0
Share

Bump. I'm having the same issue, this is on iOS with the 4.6 beta (b20). Rotation works great until I force it to a certain setting in script; after that, auto-rotation no longer works.

In addition to that: when I force-orient the screen to landscape mode, background the app and then come back, the whole frame seems to rotate 90° with half being rendered outside the screen bounds, which renders the app unusable. Setting Screen.orientation to any value doesn't fix this. Anyone have any ideas?

avatar image vprabhumss · Oct 16, 2014 at 01:00 PM 0
Share

What kennyd-itp has written above is also the same issue Im facing. Damn ios8 view controller changes has broken the orientation aspect of Unity which was totally fine in ios7.

avatar image lilboylost · Nov 05, 2014 at 05:58 AM 0
Share

I am having the same issue, any solution/ bug id?

avatar image jallen720 · Mar 12, 2015 at 08:57 PM 0
Share

Same issue for Android in Unity 5

1 Reply

· Add your reply
  • Sort: 
avatar image
5
Wiki

Answer by ThumbSnail · Apr 29, 2015 at 02:33 AM

Setting Screen.orientation = ScreenOrientation.LandscapeLeft; forces the screen into landscape mode, but it also prevents the screen from rotating.

Thus, after setting the autorotate bools, you'll need to include this line:

Screen.orientation = ScreenOrientation.AutoRotation;

In your case, it should now rotate between the landscape orientations only.

Comment
Add comment · Show 1 · Share
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 Fattie · Jan 31, 2016 at 07:48 PM 0
Share

very nice tip.

I sent you 10 reward points :)

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

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Loading Portrait Scene from Landscape crashes the app 0 Answers

iPhoneKeyboard question... again! 0 Answers

When are Screen.width and Screen.height updated after changing the Screen.orientation value? 0 Answers

Accelerometer Auto rotate Issue 2 Answers

Splash Screen Orientation is incorrect at start app. 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