- Home /
Question by
el_rolas · May 31, 2013 at 11:01 PM ·
guitexturescreen.height
Screen.Height not getting the correct value
Hi everybody, I'm Having a issue with screen.height in Unity Android, no matter wich resolution I choose to test, screen.height always give me the same value.
screen.width works perfect, but screen.height is always the same value and I dont Know why.
Here is my code, and What I'm trying to do, is to organize Touch Buttons on Screen.
public enum Buttons{Joystick1,Joystick2,buttonA,buttonB,pad,pause}
var controlType:Buttons;
var Control:GUITexture;
var screenHeight:int;
var screenWidth:int;
var textureHeight:int=60;
var textureWidth:int=60;
var customInsetX:int;
var customInsetY:int;
function Awake()
{
screenWidth = Screen.width;
screenHeight= Screen.height;
}
function Start () {
if(controlType==Buttons.buttonA)
{
Control.pixelInset=Rect(screenWidth-customInsetX,screenHeight-customInsetY,textureHeight,textureWidth);
}
}
Comment
What happens if you actually just use Screen.height and Screen.width, ins$$anonymous$$d of assigning those to variables?
Your answer
Follow this Question
Related Questions
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
pickup count on GUI 1 Answer
3d Mask on GUI Texture, its possible? 0 Answers
I have yet more problems with gui and bullets Help please 1 Answer
simple x-y joystick 0 Answers