'Input' does not contain a definition for

2019-08-09 10:46发布

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条回答
【Aperson】
2楼-- · 2019-08-09 10:49

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

查看更多
登录 后发表回答