iLMS知識社群歷程檔登入
位置: 黃國哲 > Unity
1100906 在Parent裡放入Prefab
by 黃國哲 2021-09-06 16:06:54, 回應(0), 人氣(442)
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);
           
    }

}

回應