首页 > 其他 > 详细

U3D 精灵的点击监听

时间:2015-12-27 19:09:55      阅读:249      评论:0      收藏:0      [点我收藏+]

U3D游戏中,可能会用到点击对象,完成某项操作,

方法一:可以通过接收Input对象的输入,进行利用

方法二:给对象绑定一个collier 组件,然后就能后使用内置方法

    void OnMouseDown() {
        print("鼠标按下了");
    }

只要给精灵绑定这个组件,那么鼠标的一系列的操作就都可以完成

OnMouseDown    OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.
OnMouseDrag    OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse.
OnMouseEnter    Called when the mouse enters the GUIElement or Collider.
OnMouseExit    Called when the mouse is not any longer over the GUIElement or Collider.
OnMouseOver    Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp    OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton

 

U3D 精灵的点击监听

原文:http://www.cnblogs.com/sunxun/p/5080498.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!