Button does not work when another is active? iPhone

Hi,

I have a "fire" button,a very simple On GUI ... If(GUI.Button..., click bang! works well.

But I also have a joystick on the other side, that works via GUI texture iphone input touch.

while I am moving the character around with the joystick, the fire button does not register when I click it. only when I let go of the joystick can I fire.

any thoughts?

The OnGUI system currently has no support for multi-touch, although it probably should work in combination with other elements. It's best to leave OnGUI out of gameplay anyway for performance reasons (can still be used with menus OK).

Sounds like you only have single touch enabled. Check the iPhoneInput.multiTouchEnabled variable, and if it's false, just set it to true.

Check out the iphone example projects in the unity3d.com - support - resources section, they contain code for input sticks etc tailored for the iphone.

have you solved this issue? because i am having the same problem

Hi, In order to make the button clickable while moving with the joystick/or another button is active you need to manage the multi touch with TouchCount in the Update(), here a sample:

void Update(){

if(Input.touchCount > 0){

for(int i = 0;i<Input.touchCount;i++){
			
    Touch touch = Input.GetTouch(i);
    if(touch.phase == TouchPhase.Began && buttonRect.Contains(new Vector2(touch.position.x,Screen.height - touch.position.y))){

//your code to execture

			}
			
		}
	}

}