[unity] Set Mipmap Bias was not persisted on recent Unity versions. Closes #1877.

This commit is contained in:
Harald Csaszar 2021-04-08 19:17:46 +02:00
parent 97b3f3058b
commit 6c40624d5e

View File

@ -136,7 +136,10 @@ namespace Spine.Unity.Editor {
if (SpineInspectorUtility.LargeCenteredButton(SpineInspectorUtility.TempContent("Set Mipmap Bias to " + SpinePreferences.DEFAULT_MIPMAPBIAS, tooltip: "This may help textures with mipmaps be less blurry when used for 2D sprites."))) {
foreach (var m in atlasAsset.materials) {
var texture = m.mainTexture;
texture.mipMapBias = SpinePreferences.DEFAULT_MIPMAPBIAS;
string texturePath = AssetDatabase.GetAssetPath(texture.GetInstanceID());
var importer = (TextureImporter)TextureImporter.GetAtPath(texturePath);
importer.mipMapBias = SpinePreferences.DEFAULT_MIPMAPBIAS;
EditorUtility.SetDirty(texture);
}
Debug.Log("Texture mipmap bias set to " + SpinePreferences.DEFAULT_MIPMAPBIAS);
}