- Home /
Game OPTIMIZATION methods
Hi! I know that there're a lot of questions about this on this page, but I can't find answer for MY game.
In my game there's a looot of small cubes which are using physics (rigidbodys with gravity switched on etc). It's because I shoot projectiles to cubes. Some of targets are windows, which are trashing and makes a lot of small cubes. I do only 1/3 of my level and already the game is lagging (Normally there's about 70 FPS, but when I shoot too much cubes and windows it decreases to about 1-6 FPS).
I tried to: - Disable scripts, when they do their job (there're a script for 90% of cubes, so I thought it can be very useful);
I know that games like this are hard to optimize, but I hope you can tell me some hints and reply me.
Sorry for my bad English. I hope you know what I mean. When you reply me, please use simple words and sentences.
[EDIT]: **I haven't got Pro Version of Unity and I can't use Profiler window to tell you some more important informations.**
[EDIT]: ***I see (in stats window) that value "Verts" varies between 6-40K. How can I reduce it and no delete my cubes (I see it's because my windows)?***
[EDIT]: *I forgot to tell you there's no difficult models in my game now.*
I read some of these but there's suggestions but there're for much complication games - I don't use any difficult shaders, shadows, models, textures etc. $$anonymous$$y game is simple, but I see that the number of moving my gameObjects are making this job (are making that the game is lagging).
How many rigidbodies are we talking about? Do they all need to be rigidbodies? You might just be co$$anonymous$$g up against the fact that physics performance of lots (>100) of interacting objects can get real slow real fast.
If you're also creating a lot of cubes on the fly, you might want to look into reducing your calls to Instantiate with object pools.
Yes, they must have rigidbodies. But thanks for link to object pools. It can be useful. Are there any other methods to optimize my game?
I see (in stats window) that value "Verts" varies between 6-40$$anonymous$$. How can I reduce it and no delete my cubes
6k-40k verts, 24 verts per cube => means 250 - 1600 cubes ? If this is correct I don't think there's any amount of optimizing that will make you'r game run, unless you just cut the amount of rigidbodies.
Just like @lu$$anonymous$$ance said.
Answer by justin35f · May 21, 2014 at 05:31 PM
As some of the comments have stated, it sounds like you have too many game objects with rigidbodies attached. Both of these will affect performance. Each game object has scripts and components that need to be processed each frame. Each rigidbody is run through physics simulation as well. You need to consider cutting down the number of game objects that are active at any given time.
Try to keep the number of rigidbodies low. It depends on the hardware that the game is being run on (mobile, pc, web, etc...) so an exact number can't be given.