unity之鼠标的隐藏和更换图片

using UnityEngine;
using System.Collections;
/// 
/// 鼠标更换
/// 
public class MosCursor : MonoBehaviour {
    /// 
    /// 要更换的图片
    /// 
    public Texture mouseImage;
    /// 
    /// 记录鼠标的位置
    /// 
    private Vector3 msPos;
    // Use this for initialization
    void Start() {
       //把鼠标隐藏掉
        Cursor.visible = false;
    }

    // Update is called once per frame
    void Update() {

    }
    void OnGUI()
    {
        msPos = Input.mousePosition;
        GUI.DrawTexture(new Rect (msPos.x,Screen.height-msPos.y,25,25),mouseImage);
    }
}

你可能感兴趣的:(Unity3D)