My game runs slower every time I make it more efficient.
I have reworked every piece of code to unreasonable amounts for insane efficiency, I have removed objects, and I have decreased graphic quality even tough there is very few of each of those
I started doing the optimizations after I noticed a slight shock every now and then, after all the optimizations it turned into much heavier lag and shocks every time the level is loaded now
This makes no sence to me, I think its safe to say that its a extremely effecient easy to run game, its just that it isn’t, but it most definitely should
I don’t see anything that can be optimized any further, so my question I guess is how can I make it run perfectly smooth if all optimizations make it run slower
I think I’m gonna need to rebuild it completely, very very fustrated about this as all I did was make the game lighter
It’s not always very easy to predict which operations that are the least expensive. The “slight shocks” you mention is usually a result of garbage collection, which can be fixed by making sure your scripts doesn’t generate much garbage. However, you can also get similar artifacts with a perfectly fine game when testing it in Unity’s Play mode (especially if V-Sync is enabled). The fact that your game runs slower now most likely means that one step you took to optimize the game actually made it more hungry. This is not likely a problem with Unity itself, but rather your scripts, settings, or scenes. We cannot really guess what the problem is based on your post, so you may need somebody to look at your project.
If you’re not on the Pro version, maybe somebody who is can test your project and see what the profiler says.
Thanks for your reply
I know what’s most costly, a levelgenerator that uses instantiate and destroy about 2 times a second
But after writing a new one which recycled the level parts instead of destroing and instantiating it ran about the same
So I went back to the old one and decided to shorten it and make it more efficient, and that started decreasing framerate despite being much lighter, and then I just started to remove objects code and graphic quality to a bare minimum, and now it just runs terribly
Without the level generator it does run nearly flawless, still not quite but acceptable
But ofcourse I can’t go without it
It used to run flawless with a much heavier version of the same level generator though so I don’t know what’s wrong now all of a sudden
I don’t know anyone with a pro version
I guess ill just try the alternate level generator again and if it runs like it did back then I should be happy with that
Second edit: made a big improvement
I had one too many if statements in the level generator I guess, running like it used to now with a slight shock but that’s all, but the check was thethere to determine if it should spawn more level parts if the player was alive, now it’ll keep spawning when you’re gameover till infinity, but that’s ok I guess
But perhaps its possible to remove another variable check, probably not though 
But fpr now I’m satisfied with these results as its very playable and rarely noticable