Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I stop detecting input from the user in Unity? I want to achieve the following: "do not detect Input.GetMouseButtonDown" In C#?

share|improve this question
up vote 1 down vote accepted

Just do not call the input query function if you don't want any user input. Something like this:

class InputExample : MonoBehaviour
{
    public bool EnableInput = true;

    void Update()
    {
        if( EnableInput )
        {
            var mousedown = Input.GetMouseButtonDown(0);

            if( mousedown )
            {
                Debug.Log("Mouse button pressed");
            }
        }
    }
}

Now just change the EnableInput variable to false to disable input detection.

share|improve this answer
    
yup that was simple :P – gamenewdev Nov 12 '15 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.