unity改变鼠标的两种方法

方法一:换鼠标贴图,将贴图设置成Cursor

using UnityEngine;
using System.Collections;

public class MouseManage : MonoBehaviour {
    public Texture2D cursorTexture;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
    void OnMouseEnter()
    {
        Debug.Log("");
        Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.Auto);
    }
    void OnMouseExit()
    {
        Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
    }
}
 
  

方法二:将鼠标隐藏,在鼠标的位置放置一张图片

注:暂时没时间写,以后再写

你可能感兴趣的:(unity改变鼠标的两种方法)