- Home /
Massive framerate drops because of terrain
Hey, so since a time I'm doing a game for fun and to this point it all worked fine but there is a BIG issue now with the game and the issue is when i walk against a chair like you see in the video my framerate drops to ~10 fps and I think it's the terrain even if I don't know why but when I turn it off it all works fine and I don't have many details on the terrain I only have a bit of grass and I think it causes the issue especially .
Video: https://youtu.be/M_d0n8UVCzI
Settings Image:
Terrain Image:
Profiler Video: https://youtu.be/wrc4wnXlu0M
Thank You in advance! :D
Rather than guess that it's the terrain causing the framerate drop (can't see why it would be - I can't even see any terrain in that video), why not use the profiler to find out what's actually causing it? https://unity3d.com/learn/tutorials/topics/interface-essentials/introduction-profiler
Yeah i saw it at the profiler too but it says it's a script error but except from the standart fps script from unity and 3 very small scripts that don't really have to do with it there isn't much there and they shouldn't be doing this because I used them in other projects too and they worked :D
Still, can you record the profiler while you are doing this? It will point out the culprit in no time.
Unfortunately I do not get any errors so I can't really say what it is and like I said when the terrain is off or at least the grass everything works perfectly but how is that possible when I got/saw other scenes with much much more grass and other stuff.
Answer by Raresh · Jun 06, 2016 at 07:09 PM
I mean, the amount of grass i can see from the pictures won't be nearly enough to make a 960 sweat. I can tell that it's CPU bound, the profiler says it's the FixedUpdate(). Even if it's advised to put physics in FixedUpdate, can you move the code in Update()? And even if it still persists....are the objects you are hitting a kinematic rigidbody?
1: I moved the code from FixedUpdate and it started working atleast I don't get any drops at that and any other places now.
2: Beside the character there aren't any objects yet that have a rigidbody applied.
And thank you atleast for that (not permanent) but good "fix"
But I honestly still don't understand it that well bcs it's a script made by unity and not really modified by me or someone else :D
But do they have colliders? You shouldn't have a collider without a rigidbody. If you do, Unity will have to recalculate them each frame if you move them ( if they don't have a rigidbody they will be 'static').
http://answers.unity3d.com/questions/7671/guidelines-for-using-rigidbody-collider-characterc.html http://answers.unity3d.com/questions/275016/updatefixedupdate-motion-stutter-not-another-novic.html
For now I wanted all objects to be static because the house is still in work so everythime I would change something I would have to setup all the rigidbodies again and again.
Or should I do apply a rigidbody to almost every Object?
And thank you for both pages.
Okay Thank you very much for your help :DD
You saved my day ^^
Got now around 150 fps ins$$anonymous$$d of 60 - 70
Answer by Nattygolden · Jun 13, 2016 at 03:15 AM
Just accidentally found this out today. The editor itself can lag a lot (especially in unity 5) but this can be easily fixed by going to Edit-> Preferences ->GI Cache -> Clear cache
Just like that mine went from 5fps to 40fps in play mode.