From 613b098b53ce4d8e604fd40c46958a1c8796cfda Mon Sep 17 00:00:00 2001 From: John Date: Thu, 21 Dec 2017 07:11:24 +0800 Subject: [PATCH] [unity] Handle animation not found. --- spine-unity/Assets/spine-unity/SkeletonAnimation.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spine-unity/Assets/spine-unity/SkeletonAnimation.cs b/spine-unity/Assets/spine-unity/SkeletonAnimation.cs index 28463c371..71e363a18 100644 --- a/spine-unity/Assets/spine-unity/SkeletonAnimation.cs +++ b/spine-unity/Assets/spine-unity/SkeletonAnimation.cs @@ -161,8 +161,11 @@ namespace Spine.Unity { } #else if (!string.IsNullOrEmpty(_animationName)) { - state.SetAnimation(0, _animationName, loop); - Update(0); + var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(_animationName); + if (animationObject != null) { + state.SetAnimation(0, animationObject, loop); + Update(0); + } } #endif }