Version: 2021.3

QualitySettings.masterTextureLimit

切换到手册
public static int masterTextureLimit ;

描述

A texture size limit applied to most textures.

将该属性设置为 1 将使用每个纹理的第一个多级渐进纹理(因此所有纹理都是一半大小); 将其设置为 2 使用每个纹理的第二个多级渐进纹理(因此所有纹理都是四分之一大小)等等。 该属性可用于降低低端计算机的显存要求。 默认值为零。

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; } }