判断鼠标是否在GUI上面
using UnityEngine;
using System.Collections;
public class NotOnGUI : MonoBehaviour
{
public bool BeNotOnGUI;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
if (Event.current.type == EventType.MouseDown)
{
BeNotOnGUI=true;
}
else if (Event.current.type == EventType.MouseUp)
{
BeNotOnGUI=false;
}
}
}