'Input' does not contain a definition for

2019-08-09 10:35发布

问题:

I've wanted to try developing for touch screen but for some reason it said:

'Input' does not contain a definition for 'touched'

Then I tried with the old fashioned way, which worked for me a million times, but now doesn't.

'Input' does not contain a definition for 'GetMouseButton'

Does someone know the source of my problem?

    void Update() {
        if(Input.GetMouseButton(0))
            Debug.Log("Pressed left click.");

        if(Input.GetMouseButton(1))
            Debug.Log("Pressed right click.");

        if(Input.GetMouseButton(2))
            Debug.Log("Pressed middle click.");

    }

回答1:

Oh my god, I am so stupid. I've already reinstalled Unity, VS and everything maybe twice. And I didn't see what caused the problem... The problem was that I named my script 'Input' Oh my GOOOOD