This is something new that started out of the blue…
I’m on Unity 2022.3.8 LTS.
When the camera moves during play mode, the framerate drops to around half.
In the profiler, under the category “Others”, a huge amount of time is spent on “TransformChangeSystem”.
You can see this across all my CPU threads for a total of 140ms per frame!
Generally speaking, you can find the TransformChangeSystem samples below the following areas on the main thread:
PostLateUpdate.UpdateRectTransform
LateUpdate.PlayerUpdateCanvases
PostLateUpdate.UpdateAllRenderers.
When the camera stops, the problem is still there, but less so… some of the instances of ChangeSystemUpdate (I believe the first two columns in my screenshot) go away.
I also notice a huge amount of time spent on the “BoundingVolume” stuff as can be seen in the darker green spread across all the CPU threads.
Any idea what the heck is going on here? I didn’t notice any of this a few days ago, but now it’s like this. I’m guessing that something terrible went wrong in the scene, but I’m not sure where to start looking.
Sounds like something is messed up in your uGUI canvas? Maybe divide and conquer on the canvas? Maybe something 3D is getting assigned as child elements for the canvas?
So far unable to spot anything strange going on in the UIs itself.
I wanted to rule out the possibility that this is only happening in the Editor, so I made a dev build and profiled it. I get 125fps so long as the camera is not moving, regardless of scene complexity. But the slightest movement, and the framerate drops way down and then this:
So I stripped the scene down to nearly empty, ripped out all the UIs, etc. Just getting down to a barebones scene.
Now in this scenario, when we uncouple CinemachineBrain from the main camera, so that nothing touches the main camera transform, then the weird spamming of “TransformChangeSystem” goes away, and we run at a baseline of 150fps in the editor. Screenshot:
Now, we enable CinemachineBrain, so that the main camera transform is updated each frame - note however it is not actually moving. In this scenario, immediately all the CPU threads are filled with TransformChangeSystem. Note in this empty scene test, the issue has moved to the EditorLoop part - but this is irrelavent because it will appear somewhere, even in a build (see my previous shots). Having the camera actually move, and having UIs, makes the spamming appear in a lot more places - but evens stripped down to bare bones, it is still clearly happening. Screenshot:
Also side note - the issue is not directly related to CinemachineBrain - but rather simply anything that touches the main camera transform - even manually editing the position in the editor drops the frame rate briefly.
Also - I can confirm this is not the typical “frame rate drop because camera is selected” issue. My case of the threads being spammed with the transform update stuff, is regardless of what is selected, and regardless of editor vs. build (although as stated the issue can “move around” and sometimes fall under EditorLoop).