Need Help with lags
Hi all, im new in unity. i tried to make a simple snake game and it was going up pretty well until i got this lag problem as the game progressed and the snake gets longer.
i thought it might be related to memory leakage so i tried using the command Resources.UnloadUnusedAssets(); but it didn't seem to change anything.
i uploaded my project in this rar file - https://ufile.io/2rne4
could any of you please look at my code and see if there is anything that might cause it?
also, i would gladly accept helpful tips as well from anyone who experienced such problems before.
Use the build in profiler of Unity (window->profiler) to see what is causing the lag.
ok. i tried that and from what i saw it seems to point that the problem is in the body script: http://imgur.com/hH6Q6xm
could you mabye elaborate about what im seeing in this window?
Well something in the fixedUpdate is generating too much garbage if you dig in it a bit you ll find out which functions are causing the problem after that you should optimize the code.
Your answer
Follow this Question
Related Questions
Adding Audio Source creates lag? 1 Answer
Unity2D: Repeating of code makes game lag (Spawnning script) 0 Answers
2D game lagging 1 Answer
Really High CPU usage On empty scenes/new projects (ApplicationTickTimer problem) profiler pics 0 Answers
Why does unity version 2019.3.2 lag when I try to edit background 0 Answers