Optimizing Unity Game Performance

Optimizing Unity Game Performance

Optimizing Unity Games. Over 13 years, I've developed Unity games and battle-tested them on over nine platforms.

Since 2024, I've managed our Game Studio Manager; tech is passion for game development - from performance through multiplayer! Since optimizing Hire Unity 2D Developers takes so much time and is often performed at the last minute after production cycles have been completed, experienced programmers who understand Unity-based game optimization have historically been scarce.

Unfortunately, due to this factor, it often remains an underdeveloped topic, with programmers only making minor efforts at optimization during later production cycles despite its obvious importance.

SAN FRANCISCO -- (BUSINESS WIRE)Unity (NYSE: U), the world's leading platform of tools for creators to build and grow real-time games, apps, and experiences across multiple platforms, released the 2024 Unity Gaming Report today at the Game Developers Conference 2024 (GDC).

The report reveals that while 2025 was a year marked by persistent economic headwinds, game developers are strategically navigating the challenges and successfully adapting to changes in technology, the economy, and player habits by doing Despite reduced budgets, studios continue to experiment, invest, and take calculated risks in order to maximize efficiencies and resources.

Plenty of articles offer tips for optimizing a game, but none provide definitive solutions tailored specifically to you.

Recently, we completed development on an optimized game across nine platforms and took this opportunity to document our methodologies.

This article presents an outline for profiling any Unity-based match, which hope makes profiling easier!

This article cannot provide all possible optimization strategies; instead, we will focus on an approach to identify which optimizations would offer maximum gains to your game.

Discover our Unique Services - A Game Changer for Your Business!

Common Mistakes

Common Mistakes

As we begin this optimization discussion, let's cover a few no-gos to reduce standard errors. There may always be exceptions; however, if this is your first experience optimizing, avoid doing the following.

Just Weeks From Its Scheduled Due Date: This Rush Job Must Be Finished Quickly

No matter how close to its release, your game's performance must be fixed on days or weeks prior. This is particularly true if changes must be made to certain system functions.

While 60 FPS development only needs to be achieved from its inception once release is desired, it should remain close enough that work and overhauls consume only a little of your final weeks of work.

Avoid Blind Assumptions Or Go In Without Planning:

Optimization should only be pursued with a plan in mind. Only create random profiles on your PC or editor after considering an effective strategy; choose only one profiling target before making performance-related decisions, and enjoy optimizing more happily and productively! A solid optimization plan makes optimization much more enjoyable and satisfying!

Programmers tend to optimize random code bits, like optimizing user interface (UI) elements to reduce list loading time from 10ms down to 3ms; artists could increase poly count.

Although both may sound promising, neither approach generally produces noticeable improvements. Instead, it would be best to focus on improving player experiences to bring about meaningful gains in gameplay experience and engagement.

False Data When The GPU Profiler Module Is Activated By Default:

Enabling "GPU" will often produce unusable results on specific platforms; therefore, it's wiser to temporarily disable it as default (vSync will consume most of your frame, leading to things such as GPUProfiler.EndQueries appearing as significant causes).

When specific reasons for looking into GPUs are clear, use a GPU profiler as necessary to dig further.

Determine your CPU or GPU bottleneck with only the CPU profiler timeline. WaitForPresent shows the CPU waiting on the GPU, while WaitForCommands shows the GPU waiting for the CPU.

Use Unity's Deep Profiling Feature For Inaccurate Data:

Be mindful when employing this feature; do not rely on Deep Profile results when setting performance timings, nor use this when diagnosing issues if possible; only enable Deep Profiling when there is evidence of something amiss; timing results won't be helpful due to Deep Profiling adding unnecessary overhead which skews all results; the best alternative may be adding custom markers instead for improved profiling results.

Correcting Data That May Have Been Produced Incorrectly: Physics

Profiling's overhead can skew data. With increased overhead caused by profilers and profiler programs, performance will deteriorate with each FixedUpdate frame run, resulting in more FixedUpdate frames being run than your profiler shows, even though your Profiler might show that Physics is using 33% of frame time when in reality that number could be closer to 10% compared with your actual build profiler value; similarly to deep profiling this can cause you to optimize areas outside your game that need optimizing more appropriately.

Network Calls:

Unfortunately, new programmers often make the same error when developing multiplayer games: They blame networking tools such as Photon for being too heavy, seeing CPU spikes as evidence caused by methods called by Photon (known as RPCs).

You need to optimize or distribute their workload to keep this from occurring again in your game.

This Plan Is An Excellent Example Of An Optimization Plan

This Plan Is An Excellent Example Of An Optimization Plan

Below is an outline to assist with creating your multiplatform game. A good programmer must ensure each problem can be "finitized." Profiling may appear daunting at times; with this plan, Freelance Unity 2D Game Developers your gains in performance become tangible and tangible rewards!

As your base, start with selecting an inherently less stable platform. First, choose your least powerful device or PC and profile it.

We have favored Xbox One as it has slower hard drives and older CPU and GPU technologies (though switches, mobiles and other devices now compete well against it).

Prepare Yourself For Your Next Step:

An essential step when profiling is creating an optimal environment. Make every effort possible to accelerate build and runtime; the time you spend profiling will pay dividends regarding bug fixes or other tasks that arise during development.

The most crucial and prevalent modifications:

  • Automate your build with just one click! Debug builds can even skip unimportant content like splash screen videos!
  • Add multiple buttons that toggle specific tasks on and off without rebuilding, without increasing build times, to quickly build games with only one level and car per race game.

    Build time could even be decreased! Only use one vehicle and class for an accelerated build time experience in racing games.

  • Disable obfuscation if necessary and explore Unity's "Player settings" for possible solutions; one high-end console platform offers build compression, which can be turned off for rapid iteration cycles.
  • Release or debugging may help speed up Il2CPP if your code does not become the bottleneck.

    With HTML0 as its optimization loop, the optimization loop has many opportunities.

    For instance, displaying results is always much quicker when used instead of Release/Debug mode.

  • Once your first round of fixes has been implemented, rebuild your site, test out changes made during that cycle, and repeat until performance meets or surpasses expectations or time runs out.

    Before building and verifying locations, it may also be beneficial to increase baseline and spike performance levels before creating and verifying websites.

Documenting Your Performance:

Track and document the game's performance at one or several easily reproducible stages for best results. Please keep track of your profile captures and document their results to track progress and measure improvement.

To stay ahead of our rebuilds, suggest writing down CPU and GPU times and memory usage - this way, we can keep an accurate account.

The "Profile Analyzer Package" allows for a simple comparison between profiles or captures. It makes it simple and effective at quickly spotting changes or spikes between builds/settings - perfect for celebrating and documenting all your improvements with one tool.

Also Read: Why do companies hire Unity developers?

Step Two: Establish Baselines Performance

Focusing instead on attaining an acceptable baseline performance allows us to accommodate minor spikes that arise within our game loop and is critical in maintaining reasonable game loop levels - our aim is for either 30 (Mobile or Switch?) minutes or 60(PC/Mac? ).

Unity's Profiler can assist in pinpointing any performance-limiting elements to your system and only address the most significant issues.

Furthermore, its timeline view can give an insightful glimpse of your game's performance.

Check for these common problems:

Your code can be executed using Update(), FixedUpdate, and LateUpdate. Audio: Make sure not to exceed 5% CPU load for audio playback - be wary of making noise that cannot be heard! - and never play sounds that won't reach an audible volume level.

Implementing the user interface inefficiently (not correctly using canvases would cause excessive CPU use for drawings) can negatively affect performance and efficiency.

Running animations that aren't even visible is essential in optimizing physics delta time settings, and performance issues can arise as too low of an amount can cause buggy physics.

At the same time, too high may have performance impacts. When dealing with real-time physics, it is recommended that only FixedUpdate() code should be run to avoid taxing FPS performance issues.

Step 3: Spikes

Spotting spikes is made easier using the timeline as they stand out more. Points may relate to asset loading or an issue with device drive speed; testing such devices would help.

Sometimes, it only requires replacing some spikes; sometimes, spreading their weight around is sufficient. We recently performed an easy yet rewarding optimization on an old console platform by shifting one spike's weight around.

Our effort yielded impressive results: 2.0 milliseconds were lost using Main() on last-generation consoles when updating controller states; by spreading out our update method instead, we reduced that loss significantly: it fell below 0.2ms per frame! Unlike its original implementation, we only updated one controller state at once using Modulo, which operates 16 frames in each second, rather than updating all four.

Modulo can spread different operations evenly among 16 structures within a second; just one process distributes weight evenly among 16 frames in one double!

Recently, was approached by another studio to help improve their title's performance, explicitly loading spikes.

While the baseline performance of their title was good, when moving around, there would be significant spikes of lag that prevented movement.

believe this practice had been implemented to minimize GPU load while at the same time increasing CPU bottlenecking; it proved easy enough to fix as all 2.5 GB games would fit easily within console memory, so simply by stopping any unloading/loading levels, all levels remained active at all times - rather than partitioned off into chunks by dynamic loading dynamic chunks; no time lost there!

Reiterate Step 4: Spiraling Back Through Time

Begin again from Step 1, adding any improvements made. Compare results against old results to pinpoint ineffective bottlenecks.

How to Optimize

How to Optimize

This article will teach you how to recognize bottlenecks. Once you identify what issues exist Unity 2D Game Development Services within your game, making changes that will improve its efficiency can pay dividends.

Dynamic Resolution. Dynamic Resolution can provide a helpful stopgap when your GPU becomes fill rate limited and releasable; should GPU bottleneck remain present, script-controlled resolution reduction of your camera's view and not your user interface can reduce camera resolution (while not changing user experience) to optimize and lessen dependency upon tweaks while increasing visuals - although please keep in mind this only works if your GPU fill rate bound!

Increase CPU Speed with Garbage Collection" This new Unity feature may enable you not to reduce GC allocation while significantly decreasing GC spikes - one cause of CPU spikes in our projects (Switch-Unity 2019.4).

However, due to crashes, we turned it off.

CPU bottlenecking occurs due to default Unity settings such as Occlusion Culling. However, in practice, this might sound great, but our games only improve by switching it off completely.

All Unity titles we've released were CPU constrained upon release due to this heavy CPU user; Occlusion Culling proved crucial in improving game performance only after it had been completely disabled from our games' code base - however, it will vary depending on which matches it's applied too - it must be determined whether Occlusion-culling benefits or hinders it for optimal gameplay before proceeding further!

GPU CPU: SRP Rendering pipeline Our games use Deferred Rendering on higher-end platforms such as Switch, XboxOne, and PS4.

However, forward rendering was more suitable on lower-end devices like Switch, XboxOne, and PS4 due to performance gains achieved using multiple pixel lights, which our game does not operate.

What Is HDRP/URP? In practice, no other developers have experienced the performance gains offered by HDRP UP render pipelines for free.

As of July 2024, they may still be too new to be adopted by but we see great promise in their use moving forward.

GPU CPU Frame Debugger Once again, Unity's frame debugger should also be employed. Similar to the timeline profiler view, this tool helps visualize your game's operation while providing insights.

You must limit draw calls as they consume CPU time; merging materials and shaders may help achieve this objective.

Frame Debuggers provide another helpful way of finding bugs causing objects or entire screens to go black; by scrolling through callouts, you can observe precisely when something is rendered.

Learn about Other, as there are two other settings you should review before using, similar to an occlusion filter:

Dynamic Batching: Unity staff mentions it is only helpful on older devices and may incur more CPU overhead than any gains on GPU.

Unfortunately, this setting has yet to be tested, and determined its benefits or drawbacks.

Are You Looking For Other Tools:Intel VTune and PIX for Xbox were two tools we have utilized previously. At the same time, Unity's Profiler offers all of the essential tools required for significant changes to be implemented efficiently and smoothly.

Furthermore, native tools for some platforms (PIX XCode Android Studio, etc.) allow us to quickly gain device information as part of Unity's built-in tools.

Boost Your Business Revenue with Our Services!

The CPU Bottleneck

The CPU Bottleneck

Unity games typically exhibit CPU bottlenecking; when our GPU becomes bottlenecked, it's usually because we did nothing to optimize it properly.

One issue with Unity is its inefficiency in using modern machines with eight cores; we never utilize even 25% of any given CPU's processing capability! Therefore, "graphic jobs" features are crucial; unfortunately, at, we still haven't found an efficient way to implement these into our games yet.

Fixing OOM crashes and decreasing memory usage:

As someone working to optimize game performance, you are most likely to run into OutOfMemory errors or long loading times due to unoptimized assets if you are working to increase it.

While memory usage doesn't directly contribute to its overall effect on performance, optimizing memory should still be part of these optimization builds and optimized accordingly with Memory Profiler for an overview.

You must also learn more about stripping shader keywords properly - another topic requiring its article!

Boost Your Business Revenue with Our Services!

Unity Games: Best Practices to Optimize Performance

Unity Games: Best Practices to Optimize Performance

Unity games require exceptional graphics, gameplay, and reliable performance; thus, optimizing its performance across platforms and devices is vitally important.

In this article, we explore best practices to optimize Unity game performances.

  • Profiling Your Game: Before optimizing, it is critical to identify any bottlenecks.

    Unity provides useful profiling tools like Profiler to quickly pinpoint CPU, GPU, and memory bottlenecks and potential optimization areas using profiling.

  • Optimize Assets: Texture Compression: To reduce texture size efficiently and rapidly using appropriate texture compression settings such as ETC2 for mobile devices or DXT5 on consoles/PCs.
  • Texture Atlases Consolidating multiple textures into an atlas texture will reduce draw calls by consolidating into one large atlas texture.

    LOD models: Use Level of Detail models (LODs) for rendering 3D models at distances with lower polygon counts than are visible nearby.

  • Audio Compression: Audio compression can save memory while saving on space usage while script Optimizer optimizes script files further.
  • Reduce heavy update calls: Switching from Update() and FixedUpdate() operations that use less expensive operations for updates is one way.

    Another is co-routines or event-based systems as part of object pooling: By creating multiple objects simultaneously instead of creating them and then disposing of them regularly, waste collection costs will decrease substantially.

  • Select Effective Data Structures: Select efficient data structures to reduce memory use and access time and maximize draw calls.

    Static Batching: Mark objects that remain static as batchable; Unity will combine their draw calls into one draw call.

  • Dynamic Batching: Reduce your usage of dynamic GameObjects as this decreases efficiency.
  • Shadows and Lighting: Take advantage of Baked Lighting to enhance shadow quality, distance, and performance.

    And finally, Culling.

  • Frustum Curling: Enable automatic frustum curling to prevent rendering objects beyond your viewport.

    Occlusion Curling: Apply an occlusion filter to avoid causing entities to be blocked by another thing, thus improving mobile optimization.

  • An effective mobile-friendly interface: Reduce GPU load with an elegant yet simplistic design.

    Ui Sprites: Cut down on unnecessary UISprite usage by employing Sprite Atlases.

    Memory management: Mobile Devices have limited storage, ensuring efficient loading/unloading processes by managing memory effectively.

    Multithreading: Enhance asset loading/unloading while using multithreaded assets efficiently.

  • Use Unity's Job System or Burst Compiler for multithreaded CPU-bound tasks.
  • Learn How to Implement Shaders Correctly: Pick shaders that suit your target platform; simple or affordable shaders should only be utilized if necessary.

    Optimize build settings according to target platform parameters for best results.

  • Reduce executable size by eliminating unnecessary assets.
  • Testing: Regularly test game performances on different devices and platforms before optimizing.

    It is vital that testing be conducted before optimizing can take place.

  • Once every change: Should any significant modifications to your game require significant alterations, be it bug fixes, graphics upgrades, or anything else requiring substantial rework, structurally or otherwise? Conducting another profile should ensure any new issues don't surface resulting from these adjustments.

Get a Free Estimation or Talk to Our Business Manager!

Conclusion:

Optimizing Unity games' performances is an ongoing endeavor. If you want to provide users Unity 2D Programmers for Hire with an effortless gaming experience, follow best practices, and regularly profile your game - optimizing should begin from day 1 of development, not at some later point during production.

This article should have provided some initial steps toward optimizing your gaming experience or, at the very least, given you inspiration on a better mindset or approach for profiling.

wish you much success as you continue exploring more deeply into gaming!

This article was inspired by extensive performance work for Crash Drive 3 (check it!). On Thursday, July 8th, we are releasing it across nine platforms; we'll publish an article detailing this process of porting and simulating them all.

For anyone curious to gain more excellent knowledge about advanced Unity topics but needing more documentation or practical support, follow me on Twitter or LinkedIn for updates.

Paul
Full Stack Developer

Paul is a highly skilled Full Stack Developer with a solid educational background that includes a Bachelor's degree in Computer Science and a Master's degree in Software Engineering, as well as a decade of hands-on experience. Certifications such as AWS Certified Solutions Architect, and Agile Scrum Master bolster his knowledge. Paul's excellent contributions to the software development industry have garnered him a slew of prizes and accolades, cementing his status as a top-tier professional. Aside from coding, he finds relief in her interests, which include hiking through beautiful landscapes, finding creative outlets through painting, and giving back to the community by participating in local tech education programmer.

Related articles