The question is answered, right answer was accepted
Input.GetMouseButtonDown() not working
Hello, i'm using the latest version of unity and i am having this issue: I am working on a tutorial to make a simple game for android mobile and the instructor used the
Input.GetMouseButtonDown(0)
to debug using the mouse click on desktop so he wouldn't have to keep using the actual mobile to test. However, when i hit play, the object is unresponsive, i tried several debugging methods and even straight copied the example script from the script API but even so the mouse button is completely unresponsive. I tried printing in the log the current value of the boolean with
Debug.Log(Input.GetMouseButtonDown(0))
and it is always false. I also, just for the sake of trying, used
if(Input.GetAxis("Fire1")>0) Debug.Log("Clicked")
to try to identify what is the problem and since the left CTRL can be used as well as the mouse button 0 it helped me realize something. The game is only unaffected by the mouse click, since left CTRL is working, as if the button was not mapped correctly. Can anybody help?
Forgot to say that i searched the forum for answers and found none that helped. Also, yes, i'm using this function in update.
Where are you calling that? Can you post the whole method please?
I'm sorry that it took me so long to answer you. Thank you for trying to help. I don't know what i did wrong, but it seems to be working all of a sudden. Thank you for your time Nose$$anonymous$$ills
Follow this Question
Related Questions
Telling the difference between a key press, double press and hold. 0 Answers
Pause Menu script not working properly 1 Answer
Interacting with game objects by mouse click. 0 Answers
Jumping in Unity C# 2 Answers
OnMouseButtonDown 1 Answer