I’ve got a scene with a LOT of 3D objects (PickUps for the player to collect) and I need them to rotate around their local y axis. How can I do this without blowing my Framerate into oblivion?
There are a few things you can do, for best practice try and fake it by using no rotating but a static object and try some glow or something “Do you really need to rotate”? Most of the time “best practices” try and find a work around to a problem instead of relying on magic code.
-
You could call
InvokeRepeating("RotateMeFunction", 15, x)
in your Start() function to call your code every x seconds with a RotateMeFunction.
That could rotate 15 degrees, but InvokeReapeating is still being calculate, so it’s not like your saving too much. -
Your best bet would be to used a fixed update either locked at 30 ticks or something like this:
void FixedUpdate() { if (Time.fixedTime >= timeToRotate) { // Do your thang timeToRotate= Time.fixedTime + 60.0f; }