一、Unity获取Button组件的自身属性
将下面方法写在Button的点击事件里,即可传出当前button所依赖物体的名称
var buttonSelf = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;
Debug.Log(buttonSelf.transform.name);
二、修改Button颜色
ColorBlock cb = new ColorBlock();
cb.normalColor = Color.white;
cb.highlightedColor = Color.white;
cb.pressedColor = Color.white;
cb.disabledColor = new Color(1, 134 / 255f, 0, 1);
cb.colorMultiplier = 1;
obj.transform.Find("Button").GetComponent<Button>().colors = cb;