- Home /
Game Performance
For some reason, Unity all of a sudden just started becoming extremely laggy when in play mode, and I have no idea why, everything works very fast when Im editing things in the scene view, but when I go into play mode, I get around 4 fps. The same thing happens when I build the game and play it (.exe), except when I play the game, it's still laggy, but I get higher fps, around 10-12. However, I have no idea why it would be this slow. To test it, I removed almost all the box colliders, mesh colliders, and animations in the entire game, but still I get 4 fps in play mode within Unity, and 10-12 fps when I play the build. What I don't understand, is that the game ran at about 40 fps before I started having this problem, (which happened litteraly in a matter of minutes. One minute it ran fine, and within a course of around 5 minutes, it became extremely laggy and hasnt gotten any better since) and I had even more resources being used, with all the box colliders and animations and sounds. I've gotten rid of litteraly half of the resource intensive assets in my game, and yet it still runs extremely slow.
Any ideas? I'd really like to get this problem resolved. It would be horrible to have spent so much time on a game just to have it be entirely unplayable.
Did you add some frequent Debug.Log statements? Or print?
Actually, I have a footstep script, which plays a footstep sound depending on the tag of the mesh the player is on, and now that I think about it, it does print whatever object the player is on, like "Concrete", "Wood", "Carpet", print, not Debug.Log, and actually I think it prints every frame. Could that be the problem? The thing that confused me a little though is that it ran fine before, even with the print statements.
Dont use print for that because it prints the text every frame its better to use Debug.Log because it prints only once per call so that may fix the problem. Another thing does it in the console say Failed to compute tensor inertia, because if it does that may cause lag. Search the internet to find out how to fix it.
Debug.Logs are expensive because the walk the call stack (print probably does too, but I never use it). It's most likely you've just got something running on one object that is taking forever. You could try disabling parts of your scene to see if it suddenly speeds up.
Answer by HKFiftyOne · Apr 21, 2013 at 03:30 PM
I went through the objects in my scene, and while I was playing, I noticed I had some other things in the console, "[mecanim]: BindSkeleton: connot find Transform "right_door" I realized I had deleted parts of a door, which had a bunch of parts to it. I deleted it from the scene view, and sure enough, I'm getting around 30 fps now. And I'm sure getting rid of the print in the console would help too. Thanks for your help!
Your answer
![](https://koobas.hobune.stream/wayback/20220613100714im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Editor lags after update 0 Answers
[Mobile] Performance issues on 4k displays 0 Answers
Inventory System (Specific question) -1 Answers
Replace GameObject vs. replacing mesh and material? 2 Answers