NinjaDog

when I first imported the resource(just copy into project assets folder and switch back to the Unity),it generates two materials: A.mat and B.mat
it looks ok
but when I manually do reimport on the resource folder,it will generate some extra-blendmodes materials:
A-Additive.mat
A-Screen.mat

B-Additive.mat
B-Multply.mat
B-Screen.mat

why can the same resource be imported twice and get two different results?

and here is the my asset postProcessor ,for automatically enable the straight alpha input and transparence
using UnityEngine;
using System.Collections;
using UnityEditor;
public class MyEditor : AssetPostprocessor {

public void OnPreprocessModel()
{

}

public void OnPostprocessModel(GameObject go)
{

}

public void OnPreprocessTexture()
{


}

public void OnPostprocessTexture(Texture2D tex)
{

}


public void OnPostprocessAudio(AudioClip clip)
{

}

public void OnPreprocessAudio()
{

}

public static void OnPostprocessAllAssets(string[]importedAsset,string[] deletedAssets,string[] movedAssets,string[]movedFromAssetPaths)
{
int id = 0;
string[] materialGUIDS = UnityEditor.AssetDatabase.FindAssets("t:material");
foreach (var guid in materialGUIDS)
{
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
if ( path.IndexOf("Assets/Resources/Spine") < 0 )
continue;
var mat = UnityEditor.AssetDatabase.LoadAssetAtPath<Material>(path);
int _StraightAlphaID = Shader.PropertyToID("_StraightAlphaInput");
if (mat.HasProperty(_StraightAlphaID) && mat.GetInt(_StraightAlphaID) == 0)
{
mat.EnableKeyword("_STRAIGHT_ALPHA_INPUT");
mat.SetInt(_StraightAlphaID, (int)1);
EditorUtility.SetDirty(mat);
id ++;
}
}

string[] materialTEXS = UnityEditor.AssetDatabase.FindAssets("t:texture");
foreach (var guid in materialTEXS)
{
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
if ( path.IndexOf("Assets/Resources/Spine") < 0 )
continue;
TextureImporter ti = (TextureImporter)TextureImporter.GetAtPath(path);
if (ti && ti.alphaIsTransparency == false)
{
ti.alphaIsTransparency = true;
ti.SaveAndReimport();
id ++;
}
}

if ( id > 0 )
{
UnityEditor.AssetDatabase.SaveAssets();
UnityEditor.AssetDatabase.Refresh();
}
}

}
NinjaDog
  • Mesajlar: 23

Harald

NinjaDog yazdı:when I first imported the resource(just copy into project assets folder and switch back to the Unity),it generates two materials: A.mat and B.mat
it looks ok
but when I manually do reimport on the resource folder,it will generate some extra-blendmodes materials
Thanks for reporting and sorry for the troubles! We were able to reproduce this issue. It should generate all required blendmode materials upon first import, for some reason it happens only upon second import. What you describe as "ok" is actually wrong, and the "extra-blendmode materials" are the blend mode materials generated for each of your slots with special blend modes.

We have created an issue ticket here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1891
We will let you know once we have a bugfix available.

---

A bugfix has just been released for both the 3.8 and 4.0-beta branch. New unitypackages are available for download here as usual:
Spine Unity Download
Thanks again for reporting!
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4101

NinjaDog

NinjaDog
  • Mesajlar: 23

Harald

Thanks for reporting. Please note that there is no need to reference other forum threads, we will find every unread new posting on the forum.
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4101

NinjaDog

Thanks a lot!
NinjaDog
  • Mesajlar: 23


Dön Runtimes