一.目的
1.1 想知道:Unity 按钮(Button)的禁用和禁用与变灰
1.2 找到快捷方法
二.操作:完成
2.1 代码
/// <summary>/// 功能:设置按钮是否能点击/// </summary>/// <param name="_btn">按钮对象</param>/// <param name="_bIsCanClick">是否能点击</param>void Set_btn_startStopBle(Button _btn,bool _bIsCanClick){if (_bIsCanClick){_btn.GetComponent<Button>().enabled = true;_btn.GetComponent<Button>().interactable = true;}else{_btn.GetComponent<Button>().enabled = false;_btn.GetComponent<Button>().interactable = false;}}
如果觉得《Unity 按钮(Button)的禁用和禁用与变灰》对你有帮助,请点赞、收藏,并留下你的观点哦!