UIButton UIButtonMessage

17 篇文章 0 订阅
4 篇文章 0 订阅

如果制作的按钮只需要按钮消息,而不需要变颜色,可以给gameobject绑定UIButtonMessage脚本,或者通用脚本(Monobehaviour子类)。

否则可能会报一个警告和一个错误:

warning:
UnityEngine.Debug:LogWarning(Object, Object)
UIButtonColor:Init() (at Assets/Scripts/Lib/NGUI/Scripts/Interaction/UIButtonColor.cs:133)
UIButtonColor:Start() (at Assets/Scripts/Lib/NGUI/Scripts/Interaction/UIButtonColor.cs:73)
UIButtonColor:OnHover(Boolean) (at Assets/Scripts/Lib/NGUI/Scripts/Interaction/UIButtonColor.cs:164)
UIButton:OnHover(Boolean) (at Assets/Scripts/Lib/NGUI/Scripts/Interaction/UIButton.cs:84)

error:
NullReferenceException: Object reference not set to an instance of an object
UITweener.Begin[TweenColor] (UnityEngine.GameObject go, Single duration) (at Assets/Scripts/Lib/NGUI/Scripts/Tweening/UITweener.cs:381)
TweenColor.Begin (UnityEngine.GameObject go, Single duration, Color color) (at Assets/Scripts/Lib/NGUI/Scripts/Tweening/TweenColor.cs:80)
UIButtonColor.OnHover (Boolean isOver) (at Assets/Scripts/Lib/NGUI/Scripts/Interaction/UIButtonColor.cs:165)
UIButton.OnHover (Boolean isOver) (at Assets/Scripts/Lib/NGUI/Scripts/Interaction/UIButton.cs:84)

按钮的继承关系:UIButton : UIButtonColor,按钮自动带有颜色变换

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值