[unity] Fixed a potential null reference exception, potentially leading to failing drag and drop instantiation.

This commit is contained in:
Harald Csaszar 2024-09-20 11:31:52 +02:00
parent e54f49205c
commit ff3492d941
2 changed files with 13 additions and 1 deletions

View File

@ -207,6 +207,18 @@ namespace Spine.Unity.Editor {
if (File.Exists(blendMaterialPath)) {
newReplacement.material = AssetDatabase.LoadAssetAtPath<Material>(blendMaterialPath);
} else {
if (materialTemplate == null) {
Debug.LogError(string.Format("Failed to create blend mode material: Material template for " +
"blend mode '{0}' was null. Re-importing might fix this issue.",
materialSuffix), originalMaterial);
return null;
}
if (originalMaterial == null) {
Debug.LogError(string.Format("Failed to create blend mode material for atlas page '{0}': Original material for " +
"blend mode '{1}' was null. Re-importing might fix this issue.",
originalPage.name, materialSuffix));
return null;
}
Material blendModeMaterial = new Material(materialTemplate) {
name = originalMaterial.name + " " + materialTemplate.name,
mainTexture = originalMaterial.mainTexture

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core.",
"version": "4.2.85",
"version": "4.2.86",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",