
[ad_1]
This will not be an issue with Screen.orientation
– you simply have a bug in your code.
This if
situation:
if ( Screen.orientation == ScreenOrientation.LandscapeLeft
&& Screen.orientation == ScreenOrientation.LandscapeRight )
Says “If Screen.orientation
is concurrently each LandscapeLeft
AND LandscapeRight
…”
But clearly the telephone cannot be each laying to the left AND laying to the appropriate on the identical time. Macroscopic objects like telephones do not get to occupy two contradictory states in superposition.
So this situation is unimaginable, and all the time evaluates to false
, which means your else
block is all the time the one which executes.
It seems to be like what you need right here is:
if ( Screen.orientation == ScreenOrientation.LandscapeLeft
|| Screen.orientation == ScreenOrientation.LandscapeRight )
That double-pipe ||
is “OR” not “AND”. So we’ll execute the primary block if the telephone is both mendacity to the left, OR mendacity to the appropriate.
The else
block will then set off provided that neither of these is true (ie. the telephone is standing vertically – upright or upside-down).
Be certain to proofread your code for typos like this. 90% of the time, whenever you encounter an issue that appears like “is that this engine utilized by 1000’s of builders and profitable video games utterly and totally damaged, or did I simply make a mistake someplace?” the reply is often that you simply made a mistake someplace.
[ad_2]