GetMouseButton and GetMouseButtonDown

Hello guys, I’m 16 years old, and want to make a videogame for Android.

I have a trouble with Input.GetMouseButton (0) and GetMouseButtonDown(0). I don’t know how to make it work, I want the character jump with GetMouseButtonDown(0) (Just click) and with GetMouseButton (0) (Held tap) want to stop. Because it’s a type of infinite runner game.

The character is going to run non-stop with a tap at the start, and while he is running, he can jump. But i want to make it stop too while the person is holding the tap, but I don’t know how to make it works. I made something, but the character stop and jump. I think this happens because both condition come true.

If someone know how to make it works please leave a comment,
thanks!

    void Update () {

        bool held = Input.GetMouseButton (0);

        if(held){
            if(held){
                Debug.Log ("Held");

            }

        }

    }

When I tap, Both conditions come true :frowning:

Your code does not match what you are saying.

You have one boolean called held and you are setting it with Input.GetMouseButton(0). (line 3)

Then you are checking it once (line 5), and if it is true you are checking that value again (line 6), and of course it is true.

I think you might want to speak yourself through your intended behavior (as a series of bullet-pointed steps), and see if it reveals what you need to code.