Skip to content

Commit

Permalink
[unity] Added null-check at AnimationReferenceAsset.
Browse files Browse the repository at this point in the history
  • Loading branch information
HaraldCsaszar committed Aug 31, 2021
1 parent d9b882e commit d6df072
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -55,7 +55,8 @@ public class AnimationReferenceAsset : ScriptableObject, IHasSkeletonDataAsset {

public void Initialize () {
if (skeletonDataAsset == null) return;
this.animation = skeletonDataAsset.GetSkeletonData(AnimationReferenceAsset.QuietSkeletonData).FindAnimation(animationName);
SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(AnimationReferenceAsset.QuietSkeletonData);
this.animation = skeletonData != null ? skeletonData.FindAnimation(animationName) : null;
if (this.animation == null) Debug.LogWarningFormat("Animation '{0}' not found in SkeletonData : {1}.", animationName, skeletonDataAsset.name);
}

Expand Down

0 comments on commit d6df072

Please sign in to comment.