I was optimizing my app and found possibly a non-obvious performance bottleneck. Thought it might help others get some speed games out of their app or at least get it documented online.
Setting the parent transform of a gameobject transform is remarkably slow.
So: gameObjectTransform.parent=ntransform;
I’m guessing the reason for this is because it offsets a large portion of the calculations used to render/rotate/position the object, so it has a cascading effect, along with any other objects are children of that object, also get tweaked.
consequence of setting it as parent is that all local objects transforms need to updated along the parent transform, thats likely what is causing it.
don’t set the parent on a recurring base.
And it does not needfully need to be in update, just doing it often enough with an object with childs can be ugly enough, especially on the iphone the impact isn’t a light one.
I didn’t have it happening on an event driven basis for me. So not every update or fixed update. Even once in game while motion was happening would cause a hiccup.