Steps To Maximize Your Unity Game’s Performance

Glownight Games
4 min readNov 26, 2020

A game’s performance can make or break the experience. Playing a game that is properly optimized feels smooth and responsive, and it will have a larger audience since it can run on lower-end platforms as well.

Steps To Maximize Your Unity Game’s Performance

Maximizing unity games services and performance can be quite relative to the game that you’re working on and performance tips that may work for one game may be completely pointless for another. While each game may require a different approach to optimization, these are the key techniques you can implement in most situations.

1. Keep It Simple

I’m putting this first since it should be a general rule for any game that you build. Whenever you design a unity game you need to determine specifically what you need and, more importantly, what you don’t need to include.

I enjoy going back to old scripts or projects and finding ways to make something more efficient, often by stripping down the excess. However, think with performance in mind as you’re designing it the first time. Don’t limit yourself too much, but understand that it’s easier to build a performant game from the start rather than trying to restructure things to work better later.

2. Use the Profiler

Before you start removing lines of code, refining prefabs, and trying to make everything performant, you need to know what is actually causing performance issues. The Profiler is a great way to get an in-depth look at how your game is performing.

You’ll need to keep the window visible while playing your game. It will display categories such as CPU usage, GPU usage, Rendering, Physics, Audio, and more. You can then narrow down the specifics further within each category.

3. Batch Those Game Objects

Often, the visual aspects of a game are going to be one of the big areas in which you can improve performance. Visual elements will impact draw calls. To put it simply, anything that appears on-screen must be “drawn”. Imagine having 100 different draw calls for a scene versus optimizing your scene to have less than 5.

4. Reduce and Reuse Textures

Since batching works based on like materials, you can combine many objects together if they share one big texture. Multiple high-resolution textures will slow down performance. While you can have these in your unity game developer, you need to ensure that you’re being selective about how they are being used.

Use a Texture Atlas to combine multiple texture maps into one larger texture map. This is a common technique in AAA games and one you should be utilizing in your games. This not only helps to reduce the number of texture maps used, it also makes everything much easier to organize.

5. Use Culling to Limit What is Rendered

This is one of my favorite ways to increase performance, but maybe just because I like the way it looks when testing. To understand how culling works we need to take a look at how objects are rendered in Unity.

Frustum culling is a great way to improve performance and something Unity does by default. The problem with this alone is that it can render objects that we have no direct line of sight with. Imagine standing in front of a door and still rendering all objects behind that door. This is where Occlusion Culling comes in. To occlude is to block, and in this case a game object is blocking the view of other game objects. We can tell Unity not to render objects that are occluded using specific parameters we designate within the occlusion culling window. That allows us to only render objects that we have a direct line of sight to. There’s no reason to render an object at the far end of our camera’s view unless we can see it directly.

6. Optimize Objects that are Visible

Limiting texture sizes and combining meshes are a great way to improve performance, along with culling of all sorts. How can we improve the performance of objects that are not being culled but are too far to see in detail? LODs (Levels Of Detail) are a way to render a lower poly version of a mesh when it’s outside of a certain range. A mesh that is quite far away can be made incredibly low poly to improve performance.

7. Streamline Physics Calculations
Calculations cover a broad spectrum of mechanics in Unity, but I’ll focus on a few that are used quite often.

Raycasts Raycasts are often used to detect other objects for various things like checking distance, weapon impacts, direction, clearance etc. Find only what you need when using a Raycast. Don’t use multiple rays if one will suffice and don’t extend it past the length that you need it to travel.

Raycasts detect objects, so the less it needs to detect the better. With something like Physics.Raycast, you have the option to utilize a Layer Mask which allows you to only detect objects on a specific layer.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Glownight Games
Glownight Games

Written by Glownight Games

Glownight Games is a leading 2D and 3D Game development, video game makers, iOS & Android mobile game development company building games with great design.

No responses yet

Write a response