I’m trying to get it so that when you have the iPhone in landscape it will show one image (as a GUI Texture) and if in Portrait it would show a different image (again GUI Texture)
If got this code so far,
var iPhoneTextureLeft : GUITexture;
var iPhoneTexturePortrait : GUITexture;
function FixedUpdate(){
if ((iPhoneInput.orientation == iPhoneOrientation.LandscapeLeft) (iPhoneSettings.screenOrientation != iPhoneScreenOrientation.LandscapeLeft)){
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
}
if ((iPhoneInput.orientation == iPhoneOrientation.LandscapeRight) (iPhoneSettings.screenOrientation != iPhoneScreenOrientation.LandscapeRight)){
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeRight;
}
if ((iPhoneInput.orientation == iPhoneOrientation.Portrait) (iPhoneSettings.screenOrientation != iPhoneScreenOrientation.Portrait)){
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.Portrait;
}
if ((iPhoneInput.orientation == iPhoneOrientation.PortraitUpsideDown) (iPhoneSettings.screenOrientation != iPhoneScreenOrientation.PortraitUpsideDown)){
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.PortraitUpsideDown;
}
iPhoneKeyboard.autorotateToPortrait = false;
iPhoneKeyboard.autorotateToPortraitUpsideDown = false;
iPhoneKeyboard.autorotateToLandscapeLeft = false;
iPhoneKeyboard.autorotateToLandscapeRight = false;
}
function Start()
{
if (iPhoneOrientation.LandscapeLeft) guiTexture.texture = iPhoneTextureLeft;
if (iPhoneOrientation.LandscapeRight) guiTexture.texture = iPhoneTextureLeft;
if (iPhoneOrientation.Portrait) guiTexture.texture = iPhoneTexturePortrait;
if (iPhoneOrientation.PortraitUpsideDown) guiTexture.texture = iPhoneTexturePortrait;
}
However if I then put the 2 GUI Texture’s in the scene and into the inspector they lay one on top of the other and if I build to a device it just crashes.
Hope someone can help ![]()