此纹理关联的纹理 mipmap 限制组的名称。(只读)
如果此纹理具有 mipmap 限制组分配,则此纹理将遵循该组的TextureMipmapLimitSettings。如果此纹理没有组分配,或者指示的组不存在,则此纹理将采用QualitySettings.globalTextureMipmapLimit。如果您构造或导入此纹理,并将其分配给尚不存在的 mipmap 限制组,然后创建该 mipmap 限制组,则此纹理将遵循该新组的TextureMipmapLimitSettings。
在构造函数或纹理导入器中设置此属性,因为您无法在创建纹理后设置此属性。如果纹理没有 mipmap,则此属性无效。
此代码示例演示了如何在 Texture2D 构造函数和 AssetPostprocessor 中设置此属性。
using UnityEngine; using UnityEngine.Experimental.Rendering; #if UNITY_EDITOR using UnityEditor; #endif
public class ExampleScript : MonoBehaviour { void Start() { const int size = 32; Texture2D scriptTexture = new Texture2D(size, size, GraphicsFormat.R8G8B8A8_SRGB, Texture.GenerateAllMips, "MyGroup", TextureCreationFlags.MipChain); Debug.Log($"mipmapLimitGroup has been set to '{scriptTexture.mipmapLimitGroup}' on the script texture!"); } }
#if UNITY_EDITOR public class ExampleImporter : AssetPostprocessor { void OnPreprocessTexture() { if (assetPath.Contains("_MyGroup")) { TextureImporter textureImporter = (TextureImporter)assetImporter; textureImporter.mipmapLimitGroupName = "MyGroup"; } } } #endif
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.