Unity

August 20, 2024

why asset pipeline can dramatically impact your application’s performance

Post Image

Incorrect settings may yield larger build sizes, longer build times, and poor memory usage.

Consider using the Presets feature to help customize baseline settings for a specific project to ensure optimal settings.

Import textures correctly

  • Most of your memory will likely go to textures, so the import settings here are critical.

    In general, follow these guidelines:
  • Lower the Max Size: Use the minimum settings that produce visually acceptable results. This is non-destructive and can quickly reduce your texture memory.


Use powers of two (POT): Unity requires POT texture dimensions for mobile texture compression formats (PVRCT or ETC).

Atlas your textures: Placing multiple textures into a single texture can reduce draw calls and speed up rendering. Use the Unity SpriteAtlas or the third-party Texture Packer to atlas your textures.

Toggle off the Read/Write Enabled option: When enabled, this option creates a copy in both CPU- and GPU-addressable memory, doubling the texture’s memory footprint. In most cases, keep this disabled. If you are generating textures at runtime, enforce this via Texture2D.Apply, passing in makeNoLongerReadable set to true.

Disable unnecessary Mip Maps: Mip Maps are not needed for textures that remain at a consistent size on-screen, such as 2D sprites and UI graphics (leave Mip Maps enabled for 3D models that vary their distance from the camera).

Compress textures

Consider these two examples using the same model and texture.

The settings on the left consume almost eight times the memory as those on the right, without much benefit in visual quality.

If the quality of compressed formats such as PVRTC and ETC isn’t sufficiently high, and if ASTC is not fully supported on your target platform, try using 16-bit textures instead of 32-bit textures.

conclusion

Overall, an efficient asset pipeline ensures that your application uses resources effectively, loads quickly, and provides a smooth user experience. Neglecting the asset pipeline can result in slow load times, high memory usage, and poor overall performance.