Answer the question
In order to leave comments, you need to log in
It is necessary to test in Unity3d how the program will behave when the phone screen is rotated. How can I do this in the Unity editor itself?
Let's say this code, see below.
No matter how I change the screen resolution in the Game window, it still displays Portrait.
if(Screen.orientation == ScreenOrientation.Portrait)
{
if(Screen.orientation == ScreenOrientation.Portrait)
{
print("P");
}
if(Screen.orientation == ScreenOrientation.PortraitUpsideDown)
{
print("PUD");
}
if(Screen.orientation == ScreenOrientation.Landscape)
{
print("L");
}
if(Screen.orientation == ScreenOrientation.LandscapeRight)
{
print("LR");
}print("P");
if(Screen.orientation == ScreenOrientation.PortraitUpsideDown)
{
print("PUD");
}
if(Screen.orientation == ScreenOrientation.Landscape)
{
print("L");
}
if(Screen.orientation == ScreenOrientation.LandscapeRight)
{
print("LR");
}
Answer the question
In order to leave comments, you need to log in
Make a public parameter:
And at the beginning of the footcloth with if, do this:
ScreenOrientation screenOrientation = Application.isEditor ? editorOrientation: Screen.orientation;
if (screenOrientation == ScreenOrientation.Portrait)
{
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question