unity3d - Unity: Prefab parenting in code -
let's want multiple prefab object called childtile , parenting single prefab object called parenttile . whenever parenttile rotates, childtiles rotated around parenttile . basically wrote: public gameobject childprefab; public gameobject parentprefab; void update() { for(int = 0; < 10; i++) { gameobject clone = instantiate(childprefab, /*psuedocode: random position*/ , quaternion.identity) clone.transform.parent = parentprefab; } } the expected result during runtime, if rotate parentprefab @ scene, 10 childprefabs should rotate. i've tried many ways failed, unless manually drag childprefabs parentprefab on hierachy bar. are sure want instantiate 10 child prefabs on each frame ( update called once per frame). i think problem is, did not instantiate parent prefab. if take code, , fix it, works charm me. public gameobject childprefab; public gameobject parentprefab; void start() { gameobject parent = instantiate(pa...