1100906 在Parent裡放入Prefab
by 黃國哲
2021-09-06 16:06:54, 回應(0), 人氣(404)
![](/sys/res/icon/email.gif)
using UnityEngine;
public class prefabscript : MonoBehaviour
{
public Transform targetTransform;
public GameObject InventoryDisplayPrefab;
// Start is called before the first frame update
void Start()
{
GameObject display = Instantiate(InventoryDisplayPrefab);
display.transform.SetParent(targetTransform,false);
}
}
回應