找回密码
 立即注册
查看: 5457|回复: 80

[GUI] 替换鼠标指针为图片

[复制链接]
发表于 2013-1-10 15:21 | 显示全部楼层 |阅读模式
  用指定图片替换鼠标指针
  //用指定图片替换鼠标指针
  1. var mouse:Texture;
  2. function Update()
  3. {
  4. Screen.showCursor=false;//隐藏鼠标指针
  5. }
  6. function OnGUI()
  7. {
  8. var msPos=Input.mousePosition;//鼠标的位置
  9. GUI.DrawTexture(Rect(msPos.x,Screen.height-msPos.y,20,20),mouse);
  10. }
复制代码
本脚本要发布后才可以测试
   
   
  移到物体上换鼠标
  1. var mouse:Texture;
  2. var mousea:Texture;
  3. var mouseb:Texture;
  4. function Update()
  5. {
  6. Screen.showCursor=false;
  7. }
  8. function OnMouseOver ()
  9. {
  10. mouse = mousea;
  11. }
  12. function OnMouseExit ()
  13. {
  14.  mouse = mouseb;
  15. }
  16. function OnGUI()
  17. {
  18. var msPos=Input.mousePosition;
  19. GUI.DrawTexture(Rect(msPos.x,Screen.height-msPos.y,20,20),mouse);
  20. }
复制代码
发表于 2013-1-17 14:12 | 显示全部楼层
看帖就得顶
发表于 2013-2-27 14:59 | 显示全部楼层
看贴就回,是一种态度.
发表于 2013-2-27 22:20 | 显示全部楼层
顶一个,感谢分享~
发表于 2013-3-4 10:44 | 显示全部楼层

感谢楼主的无私分享!{:soso__11402694654016840197_7:}
发表于 2013-9-8 23:39 | 显示全部楼层

不错 不错 不错{:soso__3922851084632044791_6:}
发表于 2013-9-9 09:05 | 显示全部楼层
不錯~謝謝分享{:soso_e182:}
发表于 2013-11-7 16:00 | 显示全部楼层
顶一下{:5_399:}
发表于 2013-11-7 16:50 | 显示全部楼层
我顶,顶顶顶{:5_427:}
发表于 2014-7-2 17:03 | 显示全部楼层
顶~{:5_427:}
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-5-2 17:02 , Processed in 0.101856 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表