I’m having a problem with repeat buttons, currently i’m working on a touch interface for a racing game, basically i have 3 buttons, onefor braking, and the other 2 are for turning, to make it work i create a script with other variables for the main script.
The problem is, i have 2 buttons that work, and the 3rd just don’t, please help me with this script
var freio:Texture;
var direita:Texture;
var esquerda:Texture;
function Start()
{
touch.vertical = 1.0;
}
function OnGUI()
{
//freiar (works)
if(GUI.RepeatButton(new Rect(0,0,50,30), freio)){
touch.vertical = -1.0;
}
else
{
touch.horizontal = 1.0;
}
//esquerda (don't work)
if(GUI.RepeatButton(new Rect(100,0,50,30), esquerda)){
touch.horizontal = -1.0;
}
else
{
touch.horizontal = 0.0;
}
//direita (works)
if(GUI.RepeatButton(new Rect(50,0,50,30), direita)){
touch.horizontal = 1.0;
}
else
{
touch.horizontal = 0.0;
}
}
Thanks in Advance.