Version: 2020.3
The Mipmap Streaming system
串流控制器 (Streaming Controller)

The Mipmap Streaming system API

Use this API to override the default settings in the Mipmap Streaming system, or get more fine-grained control.


For general information about this system, see Mipmap Streaming system.


You can use the API to override behavior for specific situations, while the Mipmap Streaming system automatically manages the default settings.

This is useful if you know that Unity needs to fully load certain textures; for example, if they relate to GameObjects that move large distances quickly, or if you use instantaneous camera cuts.

Controlling the Mipmap Streaming system

To enable and control Mipmap Streaming on a texture, use the following properties:

Mipmap Streaming automatically reduces the mip level of textures until they fit into the Mipmap Streaming Memory Budget. The Texture’s Mip Map Priority number is roughly a mipmap offset for the Memory Budget. For example, with a priority of 2, the Mipmap Streaming system tries to use a mip that is two mip levels higher than other textures with a priority of 0. Negative values are also valid. If it can’t do this, it uses a lower mip level to fit the Memory Budget.



Controlling Cameras

When cutting from one location to another, the Mipmap Streaming system needs time to stream the required Textures into Unity. To trigger preloading at a disabled target Camera location, call StreamingController.SetPreloading on the target Camera’s Streaming Controller component. You can specify a time-out to end the preloading phase. To automatically enable the Camera at the end of the preloading phase, set the activateCameraOnTimeout flag to true in script. To disable a Camera after you cut from it to the new one, pass that Camera as the disableCameraCuttingFrom parameter.

void StreamingController.SetPreloading(float timeoutSeconds=0.0f, bool activateCameraOnTimeout=false, Camera disableCameraCuttingFrom=null)


To determine whether the Mipmap Streaming system is still loading Textures, you can query the following properties:

Note that there is delay between when you enable a Camera and when these properties become a value other than zero. This delay is because the Mipmap Streaming system calculates the mipmaps using time-sliced processing. For this reason, during a Camera cut you should wait a minimum length of time before the cut. Texture budget and Scene movement can cause continuous Mipmap Streaming, so you also need to set a maximum length of time before the cut.

Loading a specific mip level

要覆盖特定纹理的 Mip 级别计算,请使用 Texture2D.requestedMipmapLevel。这是一个精确的 Mip 级别,范围从 0 到特定纹理的最高 Mip 级别或者是 Max Level Reduction 值(如果该值更大)。0 表示最高分辨率的 Mip。

要检查您请求的 Mip 级别是否已加载,请使用 Texture2D.IsRequestedMipmapLevelLoaded

If you no longer want to override the mip level you requested and instead want the system to continue to calculate mip levels, use Texture2D.ClearRequestedMipmapLevel to reset the value.

要估算网格上的 UV 密度,请使用以下代码行:

float Mesh.GetUVDistributionMetric(int uvSetIndex)

可以使用 UV 分布指标根据摄像机的位置来计算所需的 Mipmap 级别。请参阅 Mesh.GetUVDistributionMetric 以查看代码示例。

要覆盖系统并强制加载所有 Mip,请使用 Texture.streamingTextureForceLoadAll

Debugging and profiling

要获取可用于创建调试可视化的材质属性中每个纹理串流信息,请使用 Texture.SetStreamingTextureMaterialDebugProperties

以下纹理属性也可用于为项目开发 Mipmap 串流性能分析/调试工具。

To get information about the number of Textures or renderers the Mipmap Streaming system is interacting with, use the following properties:

要获取有关纹理的 Mipmap 级别的信息,请使用以下属性:

Related Unity API methods



The Mipmap Streaming system
串流控制器 (Streaming Controller)