表示纹理mipmap限制设置的结构体。
此代码示例说明了如何从脚本修改 TextureMipmapLimitSettings。
#if UNITY_EDITOR using UnityEngine; using UnityEditor;
public class Example : MonoBehaviour { [MenuItem("MyMenu/Modify MyGroup")] static void ModifyMyGroup() { const string textureMipmapLimitGroupName = "MyGroup"; if (TextureMipmapLimitGroups.HasGroup(textureMipmapLimitGroupName)) { TextureMipmapLimitSettings settings = QualitySettings.GetTextureMipmapLimitSettings(textureMipmapLimitGroupName);
// For the currently active quality level, this group will now offset the Global Texture Mipmap Limit. (default behavior) settings.limitBiasMode = TextureMipmapLimitBiasMode.OffsetGlobalLimit;
// Drop 1 extra mip. Assuming that the limitBias is now 1 and that the Global Texture Mipmap Limit is 1 as well (for example), then textures assigned to 'MyGroup' drop 2 mips in total. settings.limitBias++;
QualitySettings.SetTextureMipmapLimitSettings(textureMipmapLimitGroupName, settings); } else { Debug.LogError($"Failed to modify settings, could not find texture mipmap limit group '{textureMipmapLimitGroupName}'!"); } } } #endif
其他资源:TextureMipmapLimitGroups、QualitySettings.GetTextureMipmapLimitSettings、QualitySettings.SetTextureMipmapLimitSettings。
limitBias | 要应用于全局纹理mipmap限制之上的新值。可以充当偏移量(默认)或覆盖全局纹理mipmap限制。 |
limitBiasMode | 指示 limitBias 是否充当全局纹理mipmap限制的偏移量,或者充当全局纹理mipmap限制的覆盖。 |