Handle buttons click simultaneously

Hello, i have a problem in unity3d player scripting. Actually i want to move and fire simultaneously using GUI.Buttons. My problem is whenever i move my object left or right, then i can’t fire. i have to stop clicking left/right buttons.
Here is my code.

if (GUI.RepeatButton(new Rect(Screen.width - (Screen.width - Screen.width / 20), Screen.height - Screen.height / 6, buttonWidth, buttonHeight), leftButtonTexture))
        {
            if (player.transform.position.x > -6.63f)
                player.transform.position = new Vector3(player.transform.position.x - 0.1f, player.transform.position.y, player.transform.position.z);
        }
        if (GUI.RepeatButton(new Rect(Screen.width - (Screen.width - Screen.width / 20) + buttonWidth * 1.3f, Screen.height - (Screen.height / 6), buttonWidth, buttonHeight), rightButtonTexture))
        {
            if (player.transform.position.x < 6.63f)
            player.transform.position = new Vector3(player.transform.position.x + 0.1f, player.transform.position.y, player.transform.position.z);
        }
        if (GUI.Button(new Rect(Screen.width - Screen.width / 20 - buttonWidth, Screen.height - (Screen.height / 6), buttonWidth, buttonHeight), fireButtonTexture))
        {
            Vector3 position = new Vector3(player.transform.position.x, player.transform.position.y,player.transform.position.z);
            Instantiate(fire, position, Quaternion.identity);
        }

GUI wont detect the second touch…!!!

:frowning: im building this game for android. I want to display buttons on the screens and also the multi touch feature. Suggest me what can i do for this?

Write your own code that detects the touches

I’m a newbie in unity3d. Just give me idea how to implement this feature. I will search. Any help will be appreciated.

Can you guide me about how can i make my own code for multi touch.

Please do NOT use unity GUI especially if you are building for mobile devices. It is not optimised in any way.

See: Unity - Scripting API: Input
and also: Unity - Scripting API: Touch

Look around in the different variables/functions that are available for touch input via a mobile device.

Hmmmm… Thanx for your suggestion. :slight_smile: I will do that.