Version: 2020.3
LanguageEnglish
  • C#

QualitySettings.masterTextureLimit

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 int masterTextureLimit;

Description

A texture size limit applied to most textures.

Setting this to one uses the first mipmap of each texture (so all textures are half size), setting this to two uses the second mipmap of each texture (so all textures are quarter size), etc.. This can be used to decrease video memory requirements on low-end computers. The default value is zero.

At run time, if you set masterTextureLimit to a mipmap value that has been stripped (see PlayerSettings.mipStripping), Unity sets the value to the closest mipmap value that has not been stripped.

Master texture only works on regular 2D textures. It does not adjust other texture types such as cubemaps or array textures. The master texture limit quality setting also has no effect on non-mipmapped textures.

In the following cases, 2D textures are not affected by the master texture limit: - Built-in editor resources such as UI icons and elements - Textures created at run time which are not readable, for example, after calling Apply with makeNoLongerReadable set to true - Non peristent textures, when EditorUtility.IsPersistent returns false - Rendertargets - Terrain masks

The width and height of the texture object report the original, non-limited sizes. You may have to take this into account if you perform special sampling or processing with textures subject to the master limit quality setting, and you use masterTextureLimit > 1.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Use half-size textures. QualitySettings.masterTextureLimit = 1; } }