mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fixed rare import error that material.mainTexture is null ("Material is missing texture").
This commit is contained in:
parent
c6d12296b1
commit
6fc6e090ae
@ -582,6 +582,8 @@ namespace Spine.Unity.Editor {
|
|||||||
material = defaultShader != null ? new Material(defaultShader) : null;
|
material = defaultShader != null ? new Material(defaultShader) : null;
|
||||||
if (material) {
|
if (material) {
|
||||||
ApplyPMAOrStraightAlphaSettings(material, SpineEditorUtilities.Preferences.textureSettingsReference);
|
ApplyPMAOrStraightAlphaSettings(material, SpineEditorUtilities.Preferences.textureSettingsReference);
|
||||||
|
if (texture != null)
|
||||||
|
material.mainTexture = texture;
|
||||||
AssetDatabase.CreateAsset(material, materialPath);
|
AssetDatabase.CreateAsset(material, materialPath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -589,10 +591,8 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (material != null) {
|
if (material != null) {
|
||||||
if (texture != null) {
|
if (texture != null)
|
||||||
material.mainTexture = texture;
|
material.mainTexture = texture;
|
||||||
}
|
|
||||||
|
|
||||||
EditorUtility.SetDirty(material);
|
EditorUtility.SetDirty(material);
|
||||||
// note: don't call AssetDatabase.SaveAssets() since this would trigger OnPostprocessAllAssets() every time unnecessarily.
|
// note: don't call AssetDatabase.SaveAssets() since this would trigger OnPostprocessAllAssets() every time unnecessarily.
|
||||||
populatingMaterials.Add(material); //atlasAsset.materials[i] = mat;
|
populatingMaterials.Add(material); //atlasAsset.materials[i] = mat;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user