- Home /
Question by
saerzveus45id5ttjk · Jan 10, 2015 at 01:12 PM ·
spritescalelocal
localScale not working on my mobilephone
var player : Transform;
var left : boolean = false;
var right : boolean = false;
var arrow_r : Texture2D;
var arrow_l : Texture2D;
function Update ()
{
if(right == true)
{
player.transform.localScale = Vector3(-1,1,1);
}
if(left == true)
{
player.transform.localScale = Vector3(1,1,1);
}
}
function OnGUI()
{
GUI.backgroundColor = Color.clear;
if(GUI.Button(Rect(Screen.width/3, Screen.height/1.3, Screen.width/6, Screen.height/8),arrow_l))
{
left = true;
}
else
{
left = false;
}
if(GUI.Button(Rect(Screen.width/2, Screen.height/1.3, Screen.width/6, Screen.height/8),arrow_r))
{
right = true;
}
else
{
right = false;
}
}
I tested it in Unity3D and it works, but if I test on my mobile phone the player does not scale. Any idea?
Comment