How to change button sizes depending on iOS device?

Hi everyone,

I am using code similar to the following to change button scale and position depending on whether the user has an iPhone or iPad… but it doesn’t work. What am I doing wrong!!!

 function Start () 
    {
    	if (iPhoneGeneration.iPhone3GS ||
    		iPhoneGeneration.iPhone4 ||
    		iPhoneGeneration.iPhone4S (...and so on)
    		)
    	{
    		// Pos x, pos y, height, width. Using screen height for both assures button doesn't deform
    		GasButton.pixelInset = Rect (-64, -64, (Screen.height / 4), (Screen.height / 4));
    		GasButton.transform.position.x = 0.93;
    		GasButton.transform.position.y = 0.15;
    		
    		
    	}
    	else if (iPhoneGeneration.iPad1Gen ||
    			iPhoneGeneration.iPad2Gen ||
    			iPhoneGeneration.iPad3Gen ||
    			iPhoneGeneration.iPadUnknown)
    	{
    		// Pos x, pos y, height, width. Using screen height for both assures button doesn't deform
    		GasButton.pixelInset = Rect (0, 0, (Screen.height / 8), (Screen.height / 8));
    		GasButton.transform.position.x = 0.82;
    		GasButton.transform.position.y = 0.4;
    		
    	}
    }

I should add, for the Android version of the game, the user can select whether they have a phone or a tablet, using the same code above, basically, and it works fine. It’s the iPhoneGeneration enumeration that doesn’t seem to be working for me…

Hello,

Check out this link. It is actually in Chinese. Google will help in translating it into English. This will give you details about why you can’t solve your problem and also the possible solution to it. The site also has some useful tutorials about Unity. Hope this may help…