Hi when i instantiate object it spawn at correct position as a parent. But the child objects are staying at the same position. How can i fix that?
Objects are looking like that:
Instantiate script:
public GameObject[] section;
private int zPos = 63;
public bool creatingSection = false;
public int secNum;
void Update()
{
if (creatingSection == false)
{
creatingSection = true;
StartCoroutine(GenerateSection());
}
}
IEnumerator GenerateSection()
{
secNum = Random.Range(0, section.Length);
GameObject InstantiatedSection = Instantiate(section[secNum], new Vector3(0, 0, zPos), Quaternion.identity);
zPos += 63;
yield return new WaitForSeconds(2);
creatingSection = false;
}