From ad28fd20b7e07cf65e112b6beb476648ffe67dea Mon Sep 17 00:00:00 2001 From: zhakesi Date: Mon, 27 Feb 2023 19:37:42 +0800 Subject: [PATCH] add tween function destroySelf (#14309) --- cocos/tween/tween.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cocos/tween/tween.ts b/cocos/tween/tween.ts index 4b808601d8..29fb148f70 100644 --- a/cocos/tween/tween.ts +++ b/cocos/tween/tween.ts @@ -389,6 +389,18 @@ export class Tween { return this; } + /** + * @en + * Add a destroySelf action, only for node target. + * @zh + * 添加一个移除并销毁自己 action,只适用于 target 是节点类型的。 + */ + destroySelf (): Tween { + const action = removeSelf(true); + this._actions.push(action); + return this; + } + /** * @en * Stop all tweens