- 最后登录
- 2016-10-1
- 注册时间
- 2013-12-28
- 阅读权限
- 90
- 积分
- 5805
- 纳金币
- 2954
- 精华
- 3
|
- 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,
- };
- }
- }
复制代码 |
|