OnMousedown事件只会被该脚本附加上的GameObject监控到,并且该GameObject需要有碰撞器才能实现触发该事件。
using UnityEngine;
using System.Collections;
public class ObjectInfo : MonoBehaviour {
private bool flag;
void Start(){
flag = false;
}
void onm ouseDown(){
flag = true;
}
void OnGUI(){
if(flag){
GUI.Box (new Rect (800, 20, 200, 200), "流量信息");
GUILayout.BeginArea (new Rect (800, 40, 200, 200));
GUILayout.Label ("最大流量");
GUILayout.Label ("3Qma");
GUILayout.Label ("当前流量");
GUILayout.Label ("2.13Qma");
GUILayout.EndArea();
}
}
}