using System; using System.Reflection; using UnityEngine; using UnityEngine.UI; public class OneLinkTest : MonoBehaviour { [SerializeField] private GameObject btnContainer; [SerializeField] private GameObject btn; [SerializeField] private Text message; void Start() { var aFInit = new AFInit(); aFInit.text = message; // Get funcs methods witch has Btn attribute var methods = aFInit.GetType().GetMethods(); foreach (var method in methods) { var btnAttr = method.GetCustomAttribute(); if (btnAttr == null) { continue; } var btnObj = Instantiate(btn, btnContainer.transform); btnObj.GetComponentInChildren().text = btnAttr.btnName; btnObj.GetComponent