- Home /
Unity 4.5 2D project. framerate issues in editor after upgrade. not in build.
Hi!
I'm making a 2D platformer with procedural generation. If you are familiar with Terraria this is similar and you get the idea.
I have scripts that generate lots of gameObjects, sprites, 2DColliders etc. (I have the generation set to keystrokes for testing purposes.)
Since upgrading to Unity 4.5 I've been getting wierd performance issues when playing the game in the editor. The framerate freezes every second or so depending on how many generated objects are in the scene. The more objects the worse it gets.
This was not a problem in 4.3.4, everything ran fine.
I made a new build in 4.5 to test and I get solid 60fps in standalone despite generating 10 times more objects.
Anyone know whats causing this? The framedrop acts like a freeze and happens around once every 0.5 secs or so (I interpret this as not occuring every Update or FixedUpdate) and the duration varies in severity relative to amount of objects in the scene it seems. In between the freezes the framerate goes up but never reaches beyond 30fps.
Almost all sprites renders with Sprite/Diffuse, don't know if it matters but thought i should mention. Very few lights in the scene so far(< 10).
Answer by RoleyBaxter · Jun 04, 2014 at 10:40 PM
Ok, so I figured it out. It seems the problem is the amount of separate objects shown in the Hierarchy. Seems Unity 4.5 is more sensitive to this than previous versions.
Solved the problem by setting all clones as childs to a fewer amount of objects, something I had been planning to do anyways for better organisation. Not cluddering up the Hierarchy with 100s of objects seemed to help greatly in performance.
Thanks, man! I had the same problem, had no idea what happened since unity 4.3.
$$anonymous$$y editor is still super slow compared to before, even if I have only 10 objects in the Hierarchy View. I also tried to not having a Hierarchy View at all, but I get the same lag.
I have noticed there are many things that will contribute to a slow editor.
-Putting your game window on another monitor.
-Not playing in "$$anonymous$$aximize on play"
-Having your scene view open along with your game view. (Solution is to open up the Animator window for me, covering the scene view)
-Having the profiler open.
-Having the "stats" drop down open.
-Having objects selected in the Hierarchy
Even while doing non of the above I was having significant performance issues in the editor.
$$anonymous$$y end solution was to create a new project, re-import all of my files, and put my game back together. While that doesnt sound like an ideal solution, it will solve two issues. $$anonymous$$y project is now much more clean (during the process of reimporting I was cleaning code/scene clutter/ etc) and my editor now runs amazingly smooth. I have tons of objects in my hierarchy (3000+) in a procedurally generated world running at 150+ fps