system
1
I’m a bit confused with the performance of localScale.
I have about 50 planes in my scene whose Transform is updated every Update. Everything works fine if I just change the position, eulerAngles or whatever. But if I add a line changing the localScale the framerate slows down from 60 FPS to 15 FPS, even if it is always the same scale.
Label.transform.localScale = new Vector3 ( 3, 3, 3 );
It doesn’t matter if I run it in the WebPlayer or Standalone mode. Anyone has an idea? Could there be a workaround, like setting the worldMatrix directly?
There’s this other unresolved thread with a similar topic regarding Android Transformlocalscale Very Slow and another unresolved thread
Does ransformlocalscale now use gpu.
system
2
I did find the solution to it. The slowdown issue is not the GameObject itself which I want to rescale, but its collider. Even if never using the collider, it is actually there and will be updated with a call to transform.localScale resulting in a more complex scaling.
The collider is used for physics and collision detection, which is needed in my case, the solution is quite simple - destroy the collider of your GameObject.
GameObject.Destroy ( myGameObjectrenderer.collider );
Happy Scaling!