using UnityEngine; using DG.Tweening; public class PooledAnimation : MonoBehaviour { public void OnSpawn() { DOTweenAnimation doanim = this.GetComponent(); if (doanim) doanim.DORestart(true); DOTweenPath dopath = this.GetComponent(); if (dopath) dopath.DORestart(true); } public void OnDespawn() { DOTweenAnimation doanim = this.GetComponent(); if (doanim) doanim.DORewind(); DOTweenPath dopath = this.GetComponent(); if (dopath) dopath.DORewind(); } }