From a2041fa9bbcaa76702656cbc9469ae9fc0e3c7f9 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 5 Aug 2013 07:22:48 +0200 Subject: [PATCH] Look at the material's texture name instead of the material name. --- spine-unity/Assets/Spine/AtlasAsset.cs | 4 ++-- spine-unity/Assets/Spine/SkeletonComponent.cs | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Spine/AtlasAsset.cs b/spine-unity/Assets/Spine/AtlasAsset.cs index 94f26298d..00ff77070 100644 --- a/spine-unity/Assets/Spine/AtlasAsset.cs +++ b/spine-unity/Assets/Spine/AtlasAsset.cs @@ -74,13 +74,13 @@ public class MaterialsTextureLoader : TextureLoader { String name = Path.GetFileNameWithoutExtension(path); Material material = null; foreach (Material other in atlasAsset.materials) { - if (other.name == name) { + if (other.mainTexture.name == name) { material = other; break; } } if (material == null) { - Debug.LogWarning("Material with name \"" + name + "\" not found for atlas asset: " + atlasAsset.name, atlasAsset); + Debug.LogWarning("Material with texture name \"" + name + "\" not found for atlas asset: " + atlasAsset.name, atlasAsset); return; } page.rendererObject = material; diff --git a/spine-unity/Assets/Spine/SkeletonComponent.cs b/spine-unity/Assets/Spine/SkeletonComponent.cs index af6b43eb7..a5e067edf 100644 --- a/spine-unity/Assets/Spine/SkeletonComponent.cs +++ b/spine-unity/Assets/Spine/SkeletonComponent.cs @@ -79,10 +79,14 @@ public class SkeletonComponent : MonoBehaviour { } public virtual void Update () { + if (skeletonDataAsset == null) { + Clear(); + return; + } + SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(false); - // Clear fields if missing information to render. - if (skeletonDataAsset == null || skeletonData == null) { + if (skeletonData == null) { Clear(); return; }