Hello everyone! I have a very specific, probably strange, but at the same time very actual question: how could I understand that I did something wrong when making a game judging by how it works? I have a village scene, not so large, but pretty dense, with a lot of vegetation and small props. My PC is relatively good (8gb RAM, AMD FX quad core 3.8ghz, Radeon R7 240x) and it runs the level on 28-40 fps. It depends upon the exact position. If I would try to hold the whole scene on the screen(run at the end of it and then turn around quickly) - there would be single freeze and then fps drop to 27. Still it differs a lot when walking along it. It may be 50, 55 or 43. Or 27. My friends on pretty cheap notebooks can’t handle even 10 fps. So it also does not depend upon the resolution and graphic settings much. Is it CPU issue?
So what I need to: inspect these screen please and tell me whether the information here is all right, or I should do something with it.
@Rocotosx
Finding performance choke points is actually a very difficult process and is one of the most broad issues in game development. Unfortunately, this is one of those scenarios where the Unity Profiler really comes in handy. The sad bit about that is it’s a pro-only feature (at least that’s what I gathered from several google searches).
You do seem to be getting a lot of batches/draw calls in your scene though, which can get out of hand very quickly when rendering large outdoor areas. See the “Tris” field under “Batches”? That says you’re hitting 2-4 million triangles in your scene which may be due to how many times certain objects are being rendered.
When building your levels, you want to try and make sure that you are re-using materials as often as possible. Unity can batch (static) objects that use the same material so they only get drawn once as a single object rather than several times.
Also, it’s good to know how milliseconds affect framerate. You’ll want to pay attention to the CPU: main xx.xms more than the FPS field. FPS will vary from device to device and the editor’s statistics window isn’t always accurate when it comes to the actual FPS you’ll get in game. Here are some helpful notes on milliseconds:
60FPS: ~16ms
30FPS: ~33ms
How are you designing your scene? Are the small props meant to by dynamic? Do they move at all or have physics applied to them? If not, make sure they are all set to static so Unity can batch them all together.
Several other things might help:
Culling unseen objects
Disabling objects with physics when they aren’t on screen. (this gets out of hand VERY quickly)
Applying LOD to objects
Using less expensive shaders
Minimize GC.Collect calls
There is a lot that can hinder your performance, I hope at least one of those points helps.
The Profiler was a pro only feature, since 5.0 the unity personal edition (free license) has all the pro features like the batching and the profiler. So you the tool unity give you.
Another useful feature is the frame debugger, it lets you figure out what actually been rendered and then you can figure out if that what is been rendered is correct and needed.
If you make performance test make sure to test it against a build version of the game and connect your profiler to that build. The performance in the editor ( and the memory consumption) might vidly vary from the build version.
Oh, thanks for such a detailed reply. The only thing I did to batch materials is set the “static” tick in the inspector. But I don’t see any difference, probably that doesn’t work properly.
No problem! Happy to help out. As for the static batching issue. You’ll want to make sure you have “Static Batching” set to true in your Player settings.
To get there you go to:
Edit → Project Settings → Player
There are several vertical tabs in that panel, the one you want is under “Other Settings”. Static Batching will be a toggle in there.