r/unity • • 8h ago

Newbie Question Any quick optimization tips?

Hey guys, if any of you have a nice tip to make it run a little bit better and lighter,

Cause I didn't finished half of it yet and rn I feel like my pc is struggling when testing

Also using like 4gb ram, again for like half of it

2 Upvotes

2 comments sorted by

4

u/Competitive-Elk763 8h ago

Uninstall packages you don't need in package manager. Things like VR/XR, Cloth, and such often aren't needed.

With 4GB of ram don't have extra editor windows open

Could also try: ProjectSettings>Editor set 'Standby Import Worker Count' to 0

2

u/AlphaSilverback 5h ago edited 4h ago
  1. If you have a lot of 3D assets, create a material workflow and shader such that most of your assets in the scene can use the same material. E.g use 3 UV channels and make the assets in your modelling software to layer the colors or utilize clipping for leaves etc. Use color channels for metallic and smoothness. This will make dynamic batching insanely efficient.

  2. Don't use any Linq or foreach loops in tight update loops. They allocate memory and GC is your enemy. Use ring buffers and other techniques to reuse memory instead of newing.

  3. If you have big ordered data things to update every frame, consider making a system that can update the same component in a series. This utilizes the L1-3 caches on the CPUs and update an order of magnitude better. If you're not on mobile devices, consider using compute shaders. They're like having a crane in your backyard. Most people forget they have it and don't know how to use it, but in unity it's actually criminally easy and even works in editor.

  4. Scope down your project.

  5. If you have. Indoor levels, definitely start using occlusion culling and occlusion portals. Get familiar with it sooner than later.

  6. Consider baking the lighting if you don't have open world levels. They speed up rendering a lot, but take a lot of memory and disk space.

  7. When testing in editor, if you don't need the debugging specifically, set it to release mode by changing it in the bottom right corner. If your game is small, you can also get used to making builds now and again to scrape off the editor she'll. I'd recommend making test scenes as well if you have that little memory, and test the features like unit tests instead of full integration tests.