Hi, I am new to Unity, I am making a small 2d game where all Scenes are in Portrait, The new Scene i want to change the screen orientation to Landscape, the code i found in many Forums and Discussion is:
I did try it in a simple C# script in the Start() method. and Attached the script to main camera, and many different objects but none work for me. When i Debug.Log() the screen orientation still displays Portrait.
The default orientation in project settings is Portrait. I am using Unity Remote 5 for testing it on my iPhone.
I did search in many forums and read Unity Scripts but still its not working… Any help will be really appreciated…
Thanks reigita,
I guess the problem was, it will not work in the editor it will work once i deploy it in my mobile. I think unity should give this option to change and see orientation during development.
then instead of using Screen.orientation i use myScreenOrientation
I did not do this for Input.deviceOrientation because this may not be the same as what the screen orientation is… for example they could be laying in a bed with the phone overhead and it would read as facedown which is nether landscape or portrait and did not help me with my ui layouts