- Home /
How can I defer the recalculation of child transforms whilst modifying the parent transform?
I have a situation where I need to modify the localPosition and localRotation of all child transforms belonging to a game object (of which there are many children). As far as the profiler is concerned this appears to be taking up an overly large amount of CPU time. I can only assume that setting the localPosition and/or localRotation is doing something quite expensive under the hood - like immediately recalculating the transforms of all the children. I was hoping the recalculation of the transform hierarchy would be deferred until the next time the transform is queried but I don't think this is the case. Could anybody shed some light on what setting a transform's localPosition and localRotation is actually doing behind the scenes that could cause this to be such an unexpected drain on performance. If my suspicions are correct and the child transforms are being recalculated immediately after each modification then is there a way to prevent this from happening until after I've finished modifying all the child transforms in one big batch?
Your answer
Follow this Question
Related Questions
postion scale and rotation greyed out and not working 1 Answer
Simple animations - hardcoded or import animation 1 Answer
I want to move a cube with rotation but I find this problem 1 Answer
How to keep a Gameobject in the same position after a transform.Rotate? 2 Answers
Performance of transform.localposition vs transform.position 0 Answers