网上有说,
EventSystem.current.SetSelectedGameObject(gameObject);
也有人这样说
UI.Button.Select();
网上也有讲如何动态改变spritestate
//(你TMD,改变一下,调用一下api,设一下值,这也配叫动态改变;对这个行业除了心凉还是心凉)
试了网上很多方法,TMD就是不行,不行
我看了一下源码,(源码可以通过ilspy传过去),不过黑科技比较多,就不赘述了
总之手游源码修改支付,看了源码,然后,整个人就不好了
! ...&%~&...%¥! &...~%! ~]
//Unity Selectable.cs源码的方法
public virtual void Select()
{
if ((UnityEngine.Object) EventSystem.current == (UnityEngine.Object) null || EventSystem.current.alreadySelecting)
return;
EventSystem.current.SetSelectedGameObject(this.gameObject);
}
也许这就是它不起作用的原因
这个我没有具体的解决办法,找到了恐怕不会添加,随意投诉
Unity源码(选择+暴风雨分布时先取消选择)
this.m_SelectionGuard = true;
if ((UnityEngine.Object) selected == (UnityEngine.Object) this.m_CurrentSelected)
{
this.m_SelectionGuard = false;
}
else
{
ExecuteEvents.Execute(this.m_CurrentSelected, pointer, ExecuteEvents.deselectHandler);
this.m_CurrentSelected = selected;
ExecuteEvents.Execute(this.m_CurrentSelected, pointer, ExecuteEvents.selectHandler);
this.m_SelectionGuard = false;
}
其实最后我发现了所谓的BUG,或者说没起作用,都是我自己的问题。
虽然调用了 Select() 方法手游源码修改支付,但使用了 Button 的高亮显示。 。 。 。 。 。 。
突出显示的按钮必须设置为工作状态; 其他状态,比如Normal和Disabled,什么时候可以使用以及如何使用,参见我之前的博客
UIButton实现的源代码在哪里?