[unity] Fix AnimationReferenceAsset inspector without SkeletonDataAsset.

This commit is contained in:
pharan 2018-05-13 03:20:01 +08:00
parent debc5801c8
commit d3a38367e1

View File

@ -63,8 +63,15 @@ namespace Spine.Unity.Editor {
public override void OnInspectorGUI () {
animationNameProperty = animationNameProperty ?? serializedObject.FindProperty("animationName");
string animationName = animationNameProperty.stringValue;
Animation animation = ThisSkeletonDataAsset.GetSkeletonData(true).FindAnimation(animationName);
bool animationNotFound = animation == null;
Animation animation = null;
if (ThisSkeletonDataAsset != null) {
var skeletonData = ThisSkeletonDataAsset.GetSkeletonData(true);
if (skeletonData != null) {
animation = skeletonData.FindAnimation(animationName);
}
}
bool animationNotFound = (animation == null);
if (changeNextFrame) {
changeNextFrame = false;