[unity] SpineEditorUtilities. Skip processing if null atlas.

This commit is contained in:
pharan 2018-12-07 03:17:48 +08:00 committed by GitHub
parent c0694bf14b
commit 2aa5685c9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -860,8 +860,9 @@ namespace Spine.Unity.Editor {
// Iterate regions and bake marked.
Atlas atlas = atlasAsset.GetAtlas();
if (atlas != null) {
FieldInfo field = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.NonPublic);
List<AtlasRegion> regions = (List<AtlasRegion>)field.GetValue(atlas);
var regions = (List<AtlasRegion>)field.GetValue(atlas);
string atlasAssetPath = AssetDatabase.GetAssetPath(atlasAsset);
string atlasAssetDirPath = Path.GetDirectoryName(atlasAssetPath);
string bakedDirPath = Path.Combine(atlasAssetDirPath, atlasAsset.name);
@ -881,6 +882,7 @@ namespace Spine.Unity.Editor {
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
}
protectFromStackGarbageCollection.Remove(atlasAsset);
return (AtlasAssetBase)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(AtlasAssetBase));