using TMPro; using UnityEngine; using UnityEngine.UI; #if UNITY_EDITOR using UnityEditor; [CustomEditor(typeof(ShopCard))] public class ShopCardEditor : Editor { public override void OnInspectorGUI() { base.OnInspectorGUI(); ShopCard shopCard = (ShopCard)target; if (GUILayout.Button("Auto Link Components")) { shopCard.AutoLink(); EditorUtility.SetDirty(shopCard); // 변경 사항 저장 } } } #endif public class ShopCard : MonoBehaviour { public string m_ID; public Image i_shopitem; public TextMeshProUGUI t_name, t_peakefficiency; public TextMeshProUGUI t_amount, t_goods; public TextMeshProUGUI t_price, t_limit, t_pricelimit; public GameObject go_btnbuy, go_btnbuylimit, go_initDesc, go_BuyComplete; shoptabledata m_Data; #if UNITY_EDITOR // 자동 연결 함수 (버튼에서 호출) public void AutoLink() { i_shopitem = DSUtil.Get_Child_T(gameObject, "i_shopitem"); t_name = DSUtil.Get_Child_T(gameObject, "t_name"); t_peakefficiency = DSUtil.Get_Child_T(gameObject, "t_peakefficiency"); t_amount = DSUtil.Get_Child_T(gameObject, "t_amount"); t_goods = DSUtil.Get_Child_T(gameObject, "t_goods"); t_price = DSUtil.Get_Child_T(gameObject, "t_price"); t_limit = DSUtil.Get_Child_T(gameObject, "t_limit"); t_pricelimit = DSUtil.Get_Child_T(gameObject, "t_pricelimit"); go_BuyComplete = DSUtil.Get_Child_GameObject(gameObject, "BuyComplete"); go_initDesc = DSUtil.Get_Child_GameObject(gameObject, "go_initDesc"); go_btnbuy = DSUtil.Get_Child_GameObject(gameObject, "btn_buy"); go_btnbuylimit = DSUtil.Get_Child_GameObject(gameObject, "btn_buylimit"); } #endif private void Awake() { var btn = go_btnbuy.GetComponent