using UnityEngine;
public class Sample : MonoBehaviour {
[SerializeField]
GameObject pCube; // InspectorでPrefabを登録しておく
void Start () {
GameObject gCube = Instantiate(pCube) as GameObject;
// Object型をGameObjectにキャスト
gCube.transform.parent = transform; // 自身の子に移動
}
}
GameObject型にキャストする必要がある。