Version: 2022.3
public static bool mipStripping ;

描述

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.

See Also: TextureImporter.ignoreMipmapLimit.