# Override the mipmap level of a texture

> Request that Unity overrides the mipmap level of a texture.

Override the mipmap level to influence which level Unity loads, rather than relying only on automatic mipmap streaming. You can do this in either of the following ways:

* The **Priority** property in the **Texture Import Settings** window of the texture.
* The [Texture2D.requestedMipmapLevel](/engine/6000.3/script-reference/unityengine/texture2d/requestedmipmaplevel.md) API.

## Use the Priority property

Follow these steps:

1. Select the texture asset in the **Project** window.
2. In the **Texture Import Settings** window, in the **Advanced** section, set a **Priority** value between -128 and 127.

When Unity needs to reduce mipmap levels to meet the memory limit, it considers textures in priority order from low to high until it meets the limit. This means textures with a higher priority value are more likely to keep their higher-resolution mipmap levels.

Unity removes a mipmap level of a lower-priority texture every time it considers textures at that priority or higher. For example, if you set one texture to a **Priority** of 1 and another texture to a **Priority** of 5, Unity might remove four mipmap levels before it considers the second texture.

You can also use the following APIs to set the **Priority** value:

* [TextureImporter.streamingMipmapsPriority](/engine/6000.3/script-reference/unityeditor/textureimporter/streamingmipmapspriority.md)
* [Texture2D.streamingMipmapsPriority](/engine/6000.3/script-reference/unityengine/texture2d/streamingmipmapspriority.md)
* [IHVImageFormatImporter.streamingMipmapsPriority](/engine/6000.3/script-reference/unityeditor/ihvimageformatimporter/streamingmipmapspriority.md)

## Use the API

The [Texture2D.requestedMipmapLevel](/engine/6000.3/script-reference/unityengine/texture2d/requestedmipmaplevel.md) API sets a specific mipmap level, overriding the level mipmap streaming would calculate. This is also necessary for [objects Unity can't calculate a level for](/engine/6000.3/manual/materials-and-shaders/textures/texture-loading/texture-streaming/use.md#unsupported). Use the following APIs:

* [Texture2D.requestedMipmapLevel](/engine/6000.3/script-reference/unityengine/texture2d/requestedmipmaplevel.md) to request that Unity overrides the mipmap level of the texture.
* [Texture2D.IsRequestedMipmapLevelLoaded](/engine/6000.3/script-reference/unityengine/texture2d/isrequestedmipmaplevelloaded.md) to check if Unity finished loading your requested mipmap level.
* [Texture2D.ClearRequestedMipmapLevel](/engine/6000.3/script-reference/unityengine/texture2d/clearrequestedmipmaplevel.md) if you no longer want to override the mipmap level.

For a basic example that pins a texture to a fixed mipmap level, refer to [Texture2D.requestedMipmapLevel](/engine/6000.3/script-reference/unityengine/texture2d/requestedmipmaplevel.md).

To manually calculate a level from the camera position, use the [Mesh.GetUVDistributionMetric](/engine/6000.3/script-reference/unityengine/mesh/getuvdistributionmetric.md) API to estimate the UV density of a mesh. For example code, refer to [Mesh.GetUVDistributionMetric](/engine/6000.3/script-reference/unityengine/mesh/getuvdistributionmetric.md).

The level you request is still subject to your [texture quality settings](/engine/6000.3/manual/unity-editor/editor-settings-reference/comp-manager-group/class-quality-settings.md#Textures). The mipmap limit can cap the resolution, so a requested level of 0 might not load the texture's full resolution. Unity can also reduce the loaded level to stay within the [memory budget](/engine/6000.3/manual/materials-and-shaders/textures/texture-loading/texture-streaming/configure.md#memory-budget), limited by the **Max Level Reduction** value and in order of texture streaming **Priority**.

### Override mipmap levels on all textures

Use [Texture.streamingTextureForceLoadAll](/engine/6000.3/script-reference/unityengine/texture/streamingtextureforceloadall.md) to load all mipmap levels for all textures.

## Additional resources

* [TextureImporter.streamingMipmaps](/engine/6000.3/script-reference/unityeditor/textureimporter/streamingmipmaps.md)
* [IHVImageFormatImporter.streamingMipmaps](/engine/6000.3/script-reference/unityeditor/ihvimageformatimporter/streamingmipmaps.md)
