using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameManager_Tools : MonoBehaviour { public List tool_Objects_Base = new List(); //public Button button; public GameObject 工具面板_content; //[HideInInspector] public string toolsname; // Start is called before the first frame update void Start() { // button.onClick.AddListener(change_toolsbutton); } // Update is called once per frame void Update() { } public void change_toolsbutton() { var load = Resources.Load("Prefab/工具按钮"); GameObject 工具按钮 = Instantiate(load) as GameObject; 工具按钮.transform.SetParent(工具面板_content.transform); 工具按钮.transform.localScale = new Vector3(1, 1, 1); 工具按钮.transform.localPosition = new Vector3(0, 0, 0); 工具按钮.transform.localEulerAngles = new Vector3(0, 0, 0); 工具按钮.GetComponent().sprite_name = toolsname; 工具按钮.GetComponent().UI_name = toolsname; 工具按钮.GetComponent().change(); } }