Started a new project a week ago and came across this very strange bug. I have objects with transform.Rotate and nothing but a transform.Rotate inside Update. Looks something like this:
void Update()
{
transform.Rotate(new Vector3(0,45,0),Space.World);
}
Doing this to an object with a collider of any type sometimes causes systematic massive choppiness (performance goes from 175 FPS to about 15).
Characteristics:
-Bug is not present 75% of the time.
-When it does occur (it begins randomly on an in-editor playtest), it occurs indefinitely until I restart my computer.
-The performance kill carries over into builds, and even people on other computers will experience the slowdown if on a build created after the slowdown in-editor has begun.
-Rebuilding the game after restarting my computer fixes the build for everyone who plays it.
-Removing the collider from the objects in question fixes the lag.
-Removing the rotate code fixes the lag.
-Nothing else I’ve tried affects the lag, so I’ve decided it is a rotation bug that only affects objects with colliders.
-Affects all collider gameobjects with rotate code regardless of whether it was there at the start or is instantiated in.
-Adding more of the object doesn’t further hurt the frame rate… just having 1 on-screen has the full effect (usually cuts the frame rate down by 150(!!!)). Effect never goes away or lessens unless every single rotating object is gone.
-Restarting Unity does NOT fix the problem.
-Changing projects does NOT fix the problem.
-Moving Rotate to LateUpdate does NOT fix or alleviate the problem.
-Even using Rotate in an invoked function that invokes only 5 times a second causes, instead of constant slowdown, 5 extreme choppiness episodes per second.
And again to clarify, restarting my computer seems to be the only fix, and it’s only temporary until it randomly occurs again.
It’s causing me some serious grief going forward on my project.
If you need more information to fix this, please tell me what you need.