hey guys easiest way to explain this is i need the same key to make different gui boxes hold different pictures depending on the current count. the error is in my Update() function. for some reason even though I have Get KeyUp (meaning it only registers when the key is released??) the count still hits 3 in 1 press meaning that it changes all 3 textures at the same time (1 press of Q). What I want to happen is the first time I press Q buff1 changes and the next time I press Q buff2 changes and then the next time buff 3 changes then it goes back to the first picture. I cant see the error in my code. please help!
cheers
var exort : Texture2D;
var quas : Texture2D;
var wex : Texture2D;
var sunStrike : Texture2D;
var chaosMeteor : Texture2D;
var forgedSpirit: Texture2D;
var emp : Texture2D;
var defeaningBlast : Texture2D;
var tornado : Texture2D;
var alacrity : Texture2D;
var iceWall : Texture2D;
var coldSnap : Texture2D;
var ghostWalk : Texture2D;
var invoke : Texture2D;
var buff1 : Texture2D;
var buff2 : Texture2D;
var buff3 : Texture2D;
var count : int;
function Start()
{
count = 1;
}
function Update()
{
if(Input.GetKeyDown("q"))
{
if(count == 1)
{
buff1 = exort;
count ++;
print("1" + count);
if(count > 3)
{
count = 1;
}
}
if(count == 2)
{
buff2 = exort;
count ++;
print("2" + count);
if(count > 3)
{
count = 1;
}
}
if(count == 3)
{
buff3 = exort;
count ++;
print("3" + count);
if(count > 3)
{
count = 1;
}
}
}
}
function OnGUI ()
{
GUI.Box (Rect (405,400,70,70),invoke); /// Invoke always same texture R
GUI.Box (Rect (165,400,70,70),quas);//Quas Wex Exort Q always same texture
GUI.Box (Rect (245,400,70,70),wex);//Quas Wex Exort W always same texture
GUI.Box (Rect (325,400,70,70),exort);//Quas Wex Exort E always same texture
GUI.Box (Rect (315,300,50,50),buff1);
GUI.Box (Rect (375,300,50,50),buff2);
GUI.Box (Rect (435,300,50,50),buff3);
GUI.Box (Rect (485,400,70,70),"5");//Spells D
GUI.Box (Rect (565,400,70,70),"6");//Spells F
}