浏览代码

[unity] Make SkeletonDataAsset safer to create at runtime.

pharan 9 年之前
父节点
当前提交
ee324f4bde
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      spine-unity/Assets/spine-unity/Asset Types/SkeletonDataAsset.cs

+ 5 - 0
spine-unity/Assets/spine-unity/Asset Types/SkeletonDataAsset.cs

@@ -161,6 +161,11 @@ namespace Spine.Unity {
 				return;
 
 			stateData.DefaultMix = defaultMix;
+
+			// For compatibility with runtime-instantiated SkeletonDataAsset.
+			if (fromAnimation == null || toAnimation == null)
+				return;
+
 			for (int i = 0, n = fromAnimation.Length; i < n; i++) {
 				if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0)
 					continue;