GQ_Communicate/GQ_TongXin/Assets/script/设备拖拽/GetSerachPrefab.cs

33 lines
803 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class GetSerachPrefab : MonoBehaviour
{
public GameObject needDragGoBtn;
public TextMeshProUGUI text;
/// <summary>
/// 选项Btn;
/// </summary>
public Button SelectBtn;
public string path;
private void Start()
{
GetPrefab();
needDragGoBtn=transform.parent.parent.parent.parent.Find("Image_拖拽设备框").GetChild(0).gameObject;
}
public void GetPrefab()
{
SelectBtn.onClick.AddListener(() =>
{
path = string.Format("古泉站机房模型90个型号/{0}", text.text);
needDragGoBtn.GetComponent<OnChlickDrag1>().prefab = Resources.Load<GameObject>(path);
});
}
}