Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

Strange code Debugging

$
0
0
Hi everyone! I'am just trying to move some children to an other gameObject, but only half was been transfered correctly!? Here my code:
        print("old Child Count " + oldGameObject.transform.childCount);
        int i = 0;
        foreach(Transform child in oldGameObject.transform) {
            print("Moving child '" + i + "' to new");
            child.parent = newGameObject.transform;
            i++;
        }
and here the result:
old Child Count 6
Moving child '0' to new
Moving child '1' to new
Moving child '2' to new
And that all... Somebody can explain that?

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>