/// <summary> /// 获取Button下的Text文本(没有则为空) /// </summary> /// <param name="btn"></param> /// <returns></returns> public static string GetText(this Button btn) { var com = ButtonExtension.Get(btn.gameObject); return(com != null?com.GetText() : string.Empty); }
/// <summary> /// 设置Button下的Text的文本(如果有的话) /// </summary> /// <param name="btn"></param> /// <param name="str"></param> public static void SetText(this Button btn, string str) { ButtonExtension.Get(btn.gameObject)?.SetText(str); }