top of page
Writer's pictureVOiD1 Gaming

Unity 2D Mobile Game Optimization

Learn basic Unity 2D Mobile Game Optimization Technique to boost up your Game Performance and increase your FPS instantly.

Optimization is a broad topic in itself, which completely depends on the game you make. Not just Game but it also depends on several other factors like Platform, Target devices, Process and many more. It’s never a final step but an iterative process to improve the performance over time. Optimization is one of the crucial steps in Game Design where you tend to increase the overall performance of your game making it lag-free, smoother gameplay and rewarding user with a beautiful experience on-demand. The Optimization Technique is for all in a Game Dev Team which includes Programmers, Artists, and Sound Designers. Depending upon the Game the responsibility of the individual field increases and differs from each other.


Optimizing a 2d Mobile Game is fairly simple and easy than Optimizing a 3D Game where we have to consider a lot of critical factors indeed. Although, the 2D Mobile Game is easy to optimize, if not done correctly it could lead up to severe performance lags. So, let’s check some of the basic Optimization Technique for Mobile Games which could potentially increase the FPS of our game instantly.


1. Use Tilemap for Level Building

Use the Tilemap system of Unity to quickly create awesome 2D levels using a tile and grid overlay. This allows you to create a combination of Sprites and game objects to a specified layer minimizing the duplication of game objects with smaller screen size. The major advantage of using the tilemap system of Unity is reduced culling cost and rending overhead, which potentially decreases the batch calls while achieving a higher frame rate.


2. Profile often while Developing

Unity Profiler is a great tool to determine the use of resources and their allocation. It’s often advised to use Unity Profiler overtime during the development to check the performance issue and fix it their itself. Use the real device while Profiling to get real and accurate data to optimize.


3. Check your Game Performance on a Low-end Device

Always check your Game on the targeted Low-End device available and optimize your game to run quite efficiently on that, this will ensure the game compatibility over other wide range of devices. This method will help you to achieve a stable frame rate on all other middle to high-end devices. Also, this will give you a brief idea of your games performance by ensuring it to run on most of the devices smoothly and reducing the time to check for each and every single device.


4. Don’t use more than ⅓ of the available RAM on your lowest-end target device.

It’s highly recommended to optimize the game to use less than 1/3rd of the available memory on the lowest targeted device. This will make sure that the Game will run pretty smoothly on all the devices even if the RAM of the specific device is much low. Further, doing this will also secure the way of games performance to be constant over time.


5. Use Object Pooling

Object Pooling is a design pattern that pre-instantiates the objects you need at any specific moment before the gameplay. Hence this reduces the need of creating any new game object and destroying it in the runtime. Object Pooling is one of the essential techniques used in the replacement of bulk destroying the game object or enabling and disabling game objects over time. This is a great way to optimize the game while giving a lower burden to the CPU and minimizing the redundant calls. This is mostly used in a shooter game or specifically dealing with bullets or spawning objects on a regular interval of time.

6. Avoid High Resolution

When developing for Mobile and especially a 2D game for mobile the texture size and resolution is an important factor to consider. This not only increases the overall size of the game but also slows down the game due to overload on memory. For a Mobile game, it’s not mandatory to inherit all the settings from the default PC properties. So, we can override the required settings for Mobile devices and set our own custom sizes and compression which will help us to achieve better results ahead. Understand various textures and their use case, this will help you to set the right amount of size required for your game. Also, consider using the MipMap generation as it reduces the rendering time and loads the texture comparatively faster.


7. Use Mobile Shaders instead

While developing games for Mobile it’s highly essential to use Mobile Friendly Shader for better performance. It’s recommended to avoid multi-pass shaders like legacy and standard shader and use Mobile Shader or the Unlit Shader instead. This will help the Game to run smoothly on all devices without and lags.


8. Disable Settings that are not in use

There are many settings in the Quality and Graphics Section of Unity’s Projects which are set by default and are not in use for most 2D Games. Leaving it to enable consumes a good amount of calculation unnecessarily and alternatively cost ahead. For example, settings like Shadow and light are two major factors affecting the project which does not deal with any of it. SO, we can disable most of such settings which are not in use to consume the overall performance loss.


9. Disable Shadows

There’s no Shadow for Unity 2D! So, don’t forget to disable all such settings before you export your game. This will make sure that Unity will not consider the project for any Shadow calculation ahead.


10. Don’t put everything on Update()

A major mistake that most beginners make is to put everything on the Update(), unaware of the fact that for an average game there are thousands of things going under calculation for every single frame. Beginners are required to understand the lifecycle of a Script and the Game to decide the right approach they should take while making games.

11. Adapt better Scripting Techniques

Use coroutines for any particular thing to check or trigger. Coroutines are super handy and give you more flexible control over the scenario. Likewise, use Unity Events and Actions to do a specific thing. This will help you to call a specific method whenever you actually require it. These are a few handy things we can use to minimize the use of the Update method on a regular basis.


12. Address Properties by ID

Unity uses property ID to address a specific Animator, Material or a Shader. So, use an integer value method instead of a string value method to address such properties. For example, the appropriate APIs are Animator.StringToHash for Animator property names, and Shader.PropertyToID for Material & Shader property names.


13. Don’t Cache Components

Using the GetComponent method too much is not very CPU friendly, and if it’s called on Update() then it will be an unnecessary load on CPU processing. It’s advisable to cache component less and use the direct referencing of components required through global variables.


14. Avoid Raycast Target wherever Possible

By default, Unity keeps the Raycast Target turned ON for the UI components to make it interactive and register user interaction. This increases the calculation time for every single object with Raycast Target ON while lowering down the overall performance. So, we can turn the Raycast Target to OFF for those events for which we don’t require to register any user interaction. For example, for a static photo in the background set on Panel or Image, we don’t require any clickable event, so we can turn OFF the Raycast Target.


15. Use Compress in Load and Play with Audio Quality Settings

Another major Setting, we need to take care of, is using the Compression type for Audios. It’s highly essential to keep the correct settings for the Audio Compression. The most general settings that would work fine would be keeping “Compress on Load” for all looping or big background music, “Native” for Small Clips, “Decompress on load” for other relevant sound but this might create CPU Spikes.

16. Use Unity’s default Material and Texture wherever possible

Unity default Material and Textures well optimized to be used with the Engine. So wherever possible you should take good advantage of Unity default Material and Texture.


17. Enable Multithread Rendering

As per the Unity Documentation, it is highly recommended to use Multithread Rendering to enhance the game performance.


18. Use Sprite Atlas instead

Using Sprite Atlas or Texture Atlas helps to reduce the overall size and conserve the compression of the texture. This is a great efficient workflow in a 2D world where you minimize the repetitive workflow of importing several Sprites and using them. This also decreases the calls and hence put no overload to CPU and GPU.


19. Use Post Processing less

Although Post Processing is a great addition to the Game Visual it could have a serious impact on low-end devices. Unity Post Processing is comparatively lighter than any other API out there in the market but still, it is performant heavy. Also, each effect available in the Post Processing stack has its own individual effect. So, choosing the right effect with a moderate setting is highly essential. Moreover, a dynamic method to enable or disable Post Effects depending upon the device capabilities would also be a great solution to this problem.


20. Use Static Batching

The term Static Batching might not be a new term for the Unity Users. You would find a lot of resources talking about the importance of Static Batching and Dynamic Batching in Unity. So the last thing from the list would be batching all game objects as static and dynamic. This will reduce the batches and calls made by Unity and hence improves the FPS. This happens as the Game Objects sharing the same material are batched together by the engine for a faster calculation. Therefore, select all the static game objects to batch together and mark them static from the top right-hand side of the inspector.


So here was a list of 20 valuable key points for the optimisation of a 2D Mobile Game in Unity that could potentially increase the game performance and remove Game lags, FPS drop and other such issues. In the upcoming article, we will have a look into the 3D Mobile Game Optimisation and other Optimisation techniques on various platforms.


Start Game Development Free of Cost

Get 100% Free Assets for your Games.
Get Started with your First Platformer Game.

Some helpful resources to brush up on your Game Development Skills -


With Love From VOiD1 Gaming


0 comments

Comments


bottom of page