Browse Source

Look at the material's texture name instead of the material name.

NathanSweet 12 years ago
parent
commit
a2041fa9bb

+ 2 - 2
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;

+ 6 - 2
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;
 		}