Bläddra i källkod

Fixed empty property value.

NathanSweet 12 år sedan
förälder
incheckning
e8ff8fd1f3

+ 2 - 2
spine-tk2d/Assets/Spine/SkeletonAnimation.cs

@@ -53,7 +53,7 @@ public class SkeletonAnimation : SkeletonComponent {
 			if (!useAnimationName) return;
 			if (_animationName == value) return;
 			_animationName = value;
-			if (value == null)
+			if (value == null || value.Length == 0)
 				state.ClearTrack(0);
 			else
 				state.SetAnimation(0, value, loop);
@@ -64,7 +64,7 @@ public class SkeletonAnimation : SkeletonComponent {
 		base.Initialize(); // Call overridden method to initialize the skeleton.
 		
 		state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
-		if (_animationName != null) state.SetAnimation(0, _animationName, loop);
+		if (_animationName != null && _animationName.Length > 0) state.SetAnimation(0, _animationName, loop);
 	}
 
 	override public void UpdateSkeleton () {

+ 2 - 2
spine-unity/Assets/Spine/SkeletonAnimation.cs

@@ -53,7 +53,7 @@ public class SkeletonAnimation : SkeletonComponent {
 			if (!useAnimationName) return;
 			if (_animationName == value) return;
 			_animationName = value;
-			if (value == null)
+			if (value == null || value.Length == 0)
 				state.ClearTrack(0);
 			else
 				state.SetAnimation(0, value, loop);
@@ -64,7 +64,7 @@ public class SkeletonAnimation : SkeletonComponent {
 		base.Initialize(); // Call overridden method to initialize the skeleton.
 		
 		state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
-		if (_animationName != null) state.SetAnimation(0, _animationName, loop);
+		if (_animationName != null && _animationName.Length > 0) state.SetAnimation(0, _animationName, loop);
 	}
 
 	override public void UpdateSkeleton () {