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

This commit is contained in:
NathanSweet 2013-08-05 07:22:48 +02:00
parent c202fc5d85
commit a2041fa9bb
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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;
}