新建文件夹Resources,将Prefabs文件夹放到该文件夹下,实例化代码如下:
GameObject itemPrefabs= Resources.Load<GameObject>("Prefabs/Item");
itemPrefabs.GetComponent<ItemUI>().UpateItemName(temp.Name);
GameObject go= GameObject.Instantiate(itemPrefabs);
go.transform.SetParent(emptyGrid);
go.transform.localPosition = Vector3.zero;
go.transform.localScale = Vector3.one;