Skip to content

t1k:cocos:playable:animation-core

FieldValue
Moduleplayable
Version0.15.0
Efforthigh
Tools

Keywords: ads, animation, cocos, flying, object pool, playable, tween

/t1k:cocos:playable:animation-core

FlyingAnimation & FlyingAnimationController

Section titled “FlyingAnimation & FlyingAnimationController”

Pooled particle-like animation system built on Cocos tween(). FlyingAnimation is the per-node Component; FlyingAnimationController is the scene singleton that manages spawning and pooling. See also: t1k-cocos-playable-signalbus.

Import paths:

  • db://assets/PLAGameFoundation/animations/FlyingAnimation
  • db://assets/PLAGameFoundation/animations/FlyingAnimationController
  • Not calling Tween.stopAllByTarget(node) before replaying on a pooled node — old tweens persist after recycle.
  • Setting autoDestroy = true when using the controller — controller handles pooling; autoDestroy must stay false.
  • Passing targetNode for a non-target animation type — ignored silently; check enum group.
  • Forgetting UIOpacity component on prefab — FlyingAnimation.onLoad auto-adds it, but only after the node is active in the scene.
  • Animation clip references hold scene assets — they don’t unload until the component is destroyed — disable doesn’t free.
  • Skeletal animation events fire on the animation thread; UI mutation must marshal to main.
  • Inspector-wired callback params must guard with typeof param === 'function', never bare ?.() or a truthy check. Any public method whose callback param may also be fired from a Cocos Inspector EventHandler (animation FINISHED handlers, button clicks, custom [EventHandler] arrays) receives the EventHandler’s CustomEventData string as its FIRST argument — it is NOT undefined. So onComplete?.() (guards only null/undefined) AND if (onComplete) onComplete() (a non-empty string is truthy) both throw onComplete is not a function. Guard with if (typeof onComplete === 'function') onComplete(); so the SAME method is safe called from code (anim.PlayReverse(() => {...})) OR from the Inspector (string arg ignored, no crash). This bug recurs because devs assume the only “absent” case is undefined; Inspector EventHandlers violate that.