U3D显示鼠标悬停位置物件的名字

来源:互联网 发布:淘宝网店推广平台 编辑:程序博客网 时间:2024/05/21 19:30
using System.Collections;using System.Collections.Generic;using UnityEngine;public class MouseClickBehaviourScript : MonoBehaviour {    bool isShowTip;    // Use this for initialization    void Start () {        isShowTip = false;}// Update is called once per framevoid Update () {}    void OnMouseEnter()    {        isShowTip = true;    }    void OnMouseExit()    {        isShowTip = false;    }    void OnGUI()    {        if (isShowTip)        {            GUI.Label(new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y, 100, 40), "My name is " + name);        }    }}

原创粉丝点击