Unity代码设置按钮选中状态

一般是设置

EventSystem.current.SetSelectedGameObject(按钮);

但是实际使用该代码无效,找了好久在unity论坛上找到实现方法,需要把选择对象先设置为null

EventSystem.current.SetSelectedGameObject(null);
EventSystem.current.SetSelectedGameObject(按钮);

猜你喜欢

转载自blog.csdn.net/qq_17765359/article/details/125274812