using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bag : MonoBehaviour {
public GameObject weizhi;//父物体
public GameObject shilihua;//需要实例化的prefab
void Update () {
if(Input.GetKeyDown(KeyCode.Q))
{
GameObject a = Instantiate(shilihua, transform.position, Quaternion.identity);//实例化物体
a.transform.parent = weizhi.transform;//把实例化的物体放到父物体weizhi之下
}
}
}
unity实例化物体到父物体之下
于 2019-01-10 10:47:15 首次发布