how to set different orientations for each scene?
i have 4 scenes i need to set scene 1 and scene 3 in landscape, scene 2 and scene 4 in portrait mode how can i do this please help me out im searching for a long time but couldnt find out the answer :(
Answer by Jessespike · Dec 10, 2015 at 09:19 PM
You mean for mobile devices right?
Read this: Unity Scripting - Screen.orientation
Screen.orientation = ScreenOrientation.LandscapeLeft;
Screen.orientation = ScreenOrientation.Portrait;
i have many game objects but i dunno in which game object i shld include the script so that it will affect the screen orientation
Doesn't matter where you put the script. I would put it on the Camera in the scene, cause this affects the screen.
so you say to create an empty script with the code you mentioned above and put the script in the camera right?
so what should be my player settings for screen and resolution?
using UnityEngine; using System.Collections;
public class Script3 : $$anonymous$$onoBehaviour {
// Use this for initialization
void Start () {
Screen.orientation = ScreenOrientation.Portrait;
}
// Update is called once per frame
void Update () {
}
}
is this script sufficient? can this be attached to camera?
and what should i click in the game tab orientation should it be free aspect or anything else?
just wondering, what happens if I set default orientation in the player settings. Will this work even then? Say, I have 10 scenes and I want only the first one to be oriented as portrait all others as landscape and I set the default orientation LanscapeLeft and on that particular scene in start function, I wrote Screen.orientation =ScreenOrientation.Portrait;