When object instantiated it doesnt change childrens position problem

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:
8389377--1106823--upload_2022-8-25_15-23-5.png
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;
    }

Example?

1 Like

You see instantiated objects Z position is 126 which is correct. And some of the children objects are in correct position, colliders in correct position. But objects image is in wrong place.


as you see in the photo

Ohh i found it. Its because static checked in some objects when i uncheck them problem solved thanks

1 Like