赞
踩
Unity的默认鼠标可以在Playersettings里设置Default Cursor的默认鼠标样式。
在代码中的设置:
- public Texture2D idleTex;
- public Texture2D clickTex;
- // Use this for initialization
- void Start ()
- {
- Screen.showCursor = false;
- }
- void OnGUI ()
- {
- Vector3 pos = Input.mousePosition;
- if (Input.GetMouseButtonDown (0))
- {
- GUI.DrawTexture (new Rect (pos.x, Screen.height - pos.y, clickTex.width, clickTex.height), clickTex);
- }
- else
- {
- GUI.DrawTexture (new Rect (pos.x, Screen.height - pos.y, idleTex.width, idleTex.height), idleTex);
- }
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。