“输入"不包含"GetMouseButton"的定义,这怎么可能? [英] 'Input' does not contain a definition for 'GetMouseButton' how is this possible?

查看:159
本文介绍了“输入"不包含"GetMouseButton"的定义,这怎么可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试开发触摸屏,但是由于某种原因它说:

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

输入"不包含触摸"的定义

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

然后我尝试了老式的方法,该方法为我工作了100万次,但现在却没有.

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

输入"不包含"GetMouseButton"的定义

'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.");

    }

推荐答案

哦,天哪,我太愚蠢了. 我已经重新安装了Unity,VS,也许所有东西都安装了两次. 而且我看不出是什么原因造成的... 问题是我将脚本命名为输入" 哦,我的天哪

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

这篇关于“输入"不包含"GetMouseButton"的定义,这怎么可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆