- Home /
Extreme lag in game
So I have had a few lag issues in my game. I have searched the internet, but with such a broad topic, its hard to find something relevant. So anyway, as usual I come to u guys for help :)
Before I added image effects, I had 180 frame per second, dipping to 60 at worst, but after adding, fps is approx. 3... eek. I don't know why its sooo bad! Ive also added a screenshot of the profiler, looks pretty awful, huh? :D If you need anything else, just ask. I must be doing something wrong.
Uhm. You should probably post some information on what's going on in the scene. And, image effects can be quite expensive.
There is a camera with a movement script that uses the horizontal and vertical axis. On right click and drag. The camera rotates around an empty game object. Also the camera can move in out out towards this empty game object.
There are about 100 columns that each have a value, which affects their position on the y axis. The script is quite messy, however after the first 3-4 seconds once they have reached the correct height, they don't change, unless the user clicks on one, followed by clicking on another one, that causes the first one to half in height, and the second one to add half the first ones height. Like I said, the scripts are very messy, but there are no repeating statements that would cause substantial lag.
Also just so you know, I have tried running the scene, trying it out without particular scripts and materials etc, but the lag barely changes. the funny thing is that it I make a new scene with the same camera, frame rate is about 10, however if I use the same scene with a new camera, frame rate is still too low. Could it be a project setting? I have turned off everything I can, anti-aliasing included, and shadows, and got rid of all camera effects and frame rate ranges from 40-80
GFX.WaitForPresent, which is what seems to be using the majority of your CPU, is actually just your CPU is waiting for your GPU. You need to exa$$anonymous$$e the GPU stats.
Answer by Vollmondum · Jul 19, 2015 at 07:43 AM
Usually that lag is caused by dozens of materials assigned within a scene. Combine them. Each of your Prefabs on load has a material assigned.
I have 9 materials that have to be assigned using code. Currently one material is applied in the start function, a black one that u can see if the photo. Of course, about 100 are being applied on start, which could very well be the issue. However, shouldn't this lag go away after it has been assigned? After the first frame, it should stabilise and recover back to high frame rate?
Your answer
Follow this Question
Related Questions
My game is lagging and i don't know how to fix 0 Answers
How to reduce Draw-Calls? 1 Answer
Weird android performance on high-end device 0 Answers
Volumetric Lighting Help 1 Answer
PROFILER: Texture.IntegrateLoadedImmediately over 150ms 0 Answers