Version: 2022.3
LanguageEnglish
  • C#

PlayerSettings.mipStripping

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static bool mipStripping;

Description

Enable mip stripping for all platforms.

When enabled, strips unused mips at build time.

When Unity builds your game or application, it can strip unused mips from Textures in your Project. Stripping unused mips can make the resulting executable smaller.

When Mip Stripping is enabled, Unity examines the Quality Settings for the current platform at build time. If a mip level is excluded from every Quality Setting for the current platform, Unity strips those mips from the build. Mip Stripping depends on the QualitySettings.globalTextureMipmapLimit and TextureMipmapLimitGroups setup, and it will only affect textures that are also affected by mipmap limits.

At run time, if you use QualitySettings.globalTextureMipmapLimit or QualitySettings.SetTextureMipmapLimitSettings to set a mip level that has been stripped, Unity sets the value to the closest mip level that has not been stripped.

Exercise caution when utilizing functionality such as the mipmap streaming API, Texture.width or Texture.mipmapCount as they do not reflect the texture's original state once mips have been stripped. For example, for a 1024x1024 texture, a Texture2D.desiredMipmapLevel value of 0 in the editor refers to a 1024x1024 mip. If we stripped 2 mips at build time from that same texture, a Texture2D.desiredMipmaplevel value of 0 refers to a 256x256 mip in the player.

Additional resources: TextureImporter.ignoreMipmapLimit.