iLMS知識社群歷程檔Login
Position: 黃國哲 > Unity
1100906 在Parent裡放入Prefab
by 黃國哲 2021-09-06 16:06:54, Reply(0), Views(201)
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);
           
    }

}

Reply