Introduction to mipmap streaming
How mipmap streaming works, and its limitations.
Read time 2 minutesLast updated 10 days ago
Use mipmap streaming to limit the size of textures in GPU memory.
How mipmap streaming works
For each texture in the camera view, Unity automatically calculates and loads mipmap levels only up to a specific level, instead of loading all of them. This means that Unity only transfers some mipmap levels per texture from disk to the CPU and the GPU.
Unity calculates which mipmap levels to load from the meshes that display a texture, their UV layouts, and each camera's position and settings. It gets these meshes from Mesh Filter or Skinned Mesh Renderer components, so only objects with one of these components contribute to this calculation. When a texture appears on multiple objects at once, Unity loads the highest resolution that any of those objects needs.
If the textures Unity needs don't all fit within the memory limit you set, Unity loads lower-resolution mipmap levels for some of the textures. If there is spare memory within the limit, Unity keeps higher-resolution mipmap levels loaded, so a texture might remain loaded at a higher resolution than the current view needs. For more information about setting a memory limit, refer to Configure mipmap streaming.
Limitations
- Unity doesn't support mipmap streaming on terrain textures, because Unity needs the highest resolution mipmap levels at all times.
- Unity doesn't support mipmap streaming with texture arrays, cubemap arrays, or 3D textures.
- If you render a texture without a Mesh Filter or Skinned Mesh Renderer — for example, with an API such as Graphics.DrawMeshNow, or through an object listed as unsupported — Unity doesn't have the information it needs to calculate a mipmap level, so it loads the lowest-resolution mipmap level your quality settings allow. To control the level, override the mipmap level manually, or disable mipmap streaming on the texture.
- Unity might not be able to calculate the correct mipmap level for textures that don't use the special property for texture tiling and offset. For more information about the
_STproperty, refer to Accessing shader properties in Cg/HLSL._ST