pause animation playing when unenabled (#2718)

add animation warn id
fix animation bug
添加注释
英文注释
This commit is contained in:
PP
2018-05-29 10:02:02 +08:00
committed by Jare Guo
parent c263ed7795
commit 9e8e43c2ff
+8
View File
@@ -262,6 +262,14 @@ var Animation = cc.Class({
animator.playState(state, startTime);
}
// Animation cannot be played when the component is not enabledInHierarchy.
// That would cause an error for the animation lost the reference after destroying the node.
// If users play the animation when the component is not enabledInHierarchy,
// we pause the animator here so that it will automatically resume the animation when users enable the component.
if (!this.enabledInHierarchy) {
animator.pause();
}
this.currentClip = state.clip;
}
return state;