浏览代码

[unity] Fixed error message "Animator is not playing an AnimatorController" at SkeletonMecanim and prefabs. Closes #1344.

Harald Csaszar 6 年之前
父节点
当前提交
74560c66a3
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs

+ 5 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs

@@ -81,8 +81,12 @@ namespace Spine.Unity {
 			if (Application.isPlaying) {
 				translator.Apply(skeleton);
 			} else {
-				if (translatorAnimator != null && translatorAnimator.isInitialized)
+				if (translatorAnimator != null && translatorAnimator.isInitialized &&
+					translatorAnimator.isActiveAndEnabled && translatorAnimator.runtimeAnimatorController != null) {
+					// Note: Rebind is required to prevent warning "Animator is not playing an AnimatorController" with prefabs
+					translatorAnimator.Rebind();
 					translator.Apply(skeleton);
+				}
 			}
 			#else
 			translator.Apply(skeleton);