@@ -123,12 +123,7 @@ export class Spine extends Container {
123
123
}
124
124
/** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link Ticker.shared} instance. */
125
125
public set autoUpdate ( value : boolean ) {
126
- if ( value ) {
127
- Ticker . shared . add ( this . internalUpdate , this ) ;
128
- this . autoUpdateWarned = false ;
129
- } else {
130
- Ticker . shared . remove ( this . internalUpdate , this ) ;
131
- }
126
+ if ( value ) this . autoUpdateWarned = false ;
132
127
this . _autoUpdate = value ;
133
128
}
134
129
@@ -171,14 +166,14 @@ export class Spine extends Container {
171
166
172
167
/** If {@link Spine.autoUpdate} is `false`, this method allows to update the AnimationState and the Skeleton with the given delta. */
173
168
public update ( deltaSeconds : number ) : void {
174
- if ( this . autoUpdate && ! this . autoUpdateWarned ) {
169
+ if ( this . _autoUpdate && ! this . autoUpdateWarned ) {
175
170
console . warn ( "You are calling update on a Spine instance that has autoUpdate set to true. This is probably not what you want." ) ;
176
171
this . autoUpdateWarned = true ;
177
172
}
178
- this . internalUpdate ( 0 , deltaSeconds ) ;
173
+ this . internalUpdate ( deltaSeconds ) ;
179
174
}
180
175
181
- protected internalUpdate ( _deltaFrame : number , deltaSeconds ?: number ) : void {
176
+ protected internalUpdate ( deltaSeconds ?: number ) : void {
182
177
// Because reasons, pixi uses deltaFrames at 60fps. We ignore the default deltaFrames and use the deltaSeconds from pixi ticker.
183
178
const delta = deltaSeconds ?? Ticker . shared . deltaMS / 1000 ;
184
179
this . state . update ( delta ) ;
@@ -191,6 +186,7 @@ export class Spine extends Container {
191
186
192
187
/** Render the meshes based on the current skeleton state, render debug information, then call {@link Container.updateTransform}. */
193
188
public override updateTransform ( ) : void {
189
+ if ( this . _autoUpdate ) this . internalUpdate ( ) ;
194
190
this . renderMeshes ( ) ;
195
191
this . sortChildren ( ) ;
196
192
this . debug ?. renderDebug ( this ) ;
0 commit comments