【发布时间】:2014-01-16 05:40:09
【问题描述】:
我正在 Unity 中开发一款汽车驾驶游戏。我试图制作一些触摸屏按钮并添加用于测试鼠标和触摸输入的 C# 脚本,但我收到控制台错误消息
"Assets/Standard Assets/MouseButton.cs(4,28): 错误 CS0246: 类型 或找不到命名空间名称“MonoBehavior”。您是否缺少 using 指令或程序集引用?”
下面列出的脚本:
using UnityEngine;
using System.Collections;
public class MouseButton : MonoBehavior {
void OnMouseDown() {
Debug.Log("The Mouse is down on " + this.name);
}
void OnMouseUp()
{
Debug.Log("The Mouse is up on " + this.name);
}
}
【问题讨论】: