From a07b7176fd6ebd042f6165966f08f3c9b72dcfc4 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Thu, 31 Jul 2025 17:29:15 +0200 Subject: [PATCH] [ts][pixi-v7][pixi-v8] Fix multiple autoUpdate calls setting multiple tickers (see #2900) --- spine-ts/spine-pixi-v7/src/Spine.ts | 6 +++--- spine-ts/spine-pixi-v8/src/Spine.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spine-ts/spine-pixi-v7/src/Spine.ts b/spine-ts/spine-pixi-v7/src/Spine.ts index d69e7f501..6e898e352 100644 --- a/spine-ts/spine-pixi-v7/src/Spine.ts +++ b/spine-ts/spine-pixi-v7/src/Spine.ts @@ -296,15 +296,15 @@ export class Spine extends Container { beforeUpdateWorldTransforms: (object: Spine) => void = () => { }; afterUpdateWorldTransforms: (object: Spine) => void = () => { }; - private _autoUpdate: boolean = true; + private _autoUpdate: boolean = false; public get autoUpdate (): boolean { return this._autoUpdate; } /** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link Ticker.shared} instance. */ public set autoUpdate (value: boolean) { - if (value) { + if (value && !this._autoUpdate) { Ticker.shared.add(this.internalUpdate, this); - } else { + } else if (!value && this._autoUpdate) { Ticker.shared.remove(this.internalUpdate, this); } this._autoUpdate = value; diff --git a/spine-ts/spine-pixi-v8/src/Spine.ts b/spine-ts/spine-pixi-v8/src/Spine.ts index ab40198aa..0b1b8a3d3 100644 --- a/spine-ts/spine-pixi-v8/src/Spine.ts +++ b/spine-ts/spine-pixi-v8/src/Spine.ts @@ -351,16 +351,16 @@ export class Spine extends ViewContainer { this._debug = value; } - private _autoUpdate = true; + private _autoUpdate = false; public get autoUpdate (): boolean { return this._autoUpdate; } /** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link Ticker.shared} instance. */ public set autoUpdate (value: boolean) { - if (value) { + if (value && !this._autoUpdate) { Ticker.shared.add(this.internalUpdate, this); - } else { + } else if (!value && this._autoUpdate) { Ticker.shared.remove(this.internalUpdate, this); }