Hello everyone.
I need desperate help on what’s going on, I’ve been here for like an hour looking at code and still have no idea what’s wrong.
Before I ask my question, here’s the code of a not-so-simple(due to functionality) button layout.
void OnGUI () {
CreateDPAD();
SetIdleness();
}
Create DPAD states the obvious.
SetIdleness checks if any button is being pressed.
private void CreateDPAD(){
CreateRightButton();
CreateLeftButton();
CreateUpButton();
CreateDownButton();
}
private void CreateUpButton(){
_upButton = UpButtonClicked ();
if (_upButton)
{
//Animation code, irrelevant to the problem. :D
}
}
private bool UpButtonClicked(){
//upClicked = true;
if(GUI.RepeatButton(new Rect(Screen.width - (BUTTON_WIDTH * 2) - 10,Screen.height - (BUTTON_HEIGHT * 3),50,50),"", "Dpad_ArrowU")){
UpActive = true;
return true;
} else {
UpActive = false;
return false;
}
}
Here’s where my debug statements are.
private void SetIdleness(){
//Debug.Log ("SettingIdleness");
if(DownActive || UpActive || LeftActive || RightActive){
Debug.Log ("A Button is Active!");
} else if(!DownActive && !UpActive && !LeftActive && !RightActive){
Debug.Log ("No Button Active");
}
}
Now, here’s the wierd part.
This function checks if Im pressing any buttons.
If no button is pressed Debug(“No active Buttons”) else (“Active Button”);
On my dbg WHILE any button is pressed I get this:
- 1st Line: Active Button…
- 2nd Line: No activeButtons…
Why is this happening???
Thanks for your time and help, I’ve been looking at code for an hour and I don’t know whats going on…