unity3d 自定义鼠标形状

using UnityEngine;
using System.Collections;

public class Cursor : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {

        //在游戏启动时就隐藏系统鼠标指针
        Screen.showCursor = false;
    }

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

        //实时修改自身的坐标,注意GUITexture的位置是以屏幕左下角为(0,0)点,右上角为(1,1)点
        transform.position = new Vector3()
        {
            x = 1 - (Screen.width - Input.mousePosition.x) / Screen.width,
            y = 1 - (Screen.height - Input.mousePosition.y) / Screen.height,
        };
    }
}

你可能感兴趣的:(Unity,3D)