Version: 2021.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. Indicates how many mipmaps should be dropped. The default value is zero.

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.

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
  • Textures where ignoreMipmapLimit is set to true

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.

When this value is changed an asynchronous re-upload of all loaded textures affected by masterTextureLimit will immediately be requested. If a texture has streamingMipmaps enabled and the Texture Streaming system already has an upload request running for that texture then it may take a few frames before a new upload request by the Texture Streamer actually applies the new masterTextureLimit.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Use half-size textures. QualitySettings.masterTextureLimit = 1; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961