@@ -57,7 +57,7 @@ var SpinePlugin = new Class({
5757 this . debugRenderer ;
5858 this . debugShader ;
5959
60- console . log ( 'SpinePlugin created. WebGL:' , this . isWebGL ) ;
60+ console . log ( 'SpinePlugin created' , '- WebGL:', this . isWebGL , this . cache , this . spineTextures ) ;
6161
6262 if ( this . isWebGL )
6363 {
@@ -91,6 +91,11 @@ var SpinePlugin = new Class({
9191 {
9292 this . bootCanvas ( ) ;
9393 }
94+
95+ var eventEmitter = this . systems . events ;
96+
97+ eventEmitter . once ( 'shutdown' , this . shutdown , this ) ;
98+ eventEmitter . once ( 'destroy' , this . destroy , this ) ;
9499 } ,
95100
96101 bootCanvas : function ( )
@@ -298,10 +303,7 @@ var SpinePlugin = new Class({
298303 {
299304 var eventEmitter = this . systems . events ;
300305
301- eventEmitter . off ( 'update' , this . update , this ) ;
302306 eventEmitter . off ( 'shutdown' , this . shutdown , this ) ;
303-
304- this . removeAll ( ) ;
305307 } ,
306308
307309 /**
@@ -316,10 +318,25 @@ var SpinePlugin = new Class({
316318 {
317319 this . shutdown ( ) ;
318320
321+ this . pluginManager . removeGameObject ( 'spine' , true , true ) ;
322+
319323 this . pluginManager = null ;
320324 this . game = null ;
321325 this . scene = null ;
322326 this . systems = null ;
327+
328+ // Create a custom cache to store the spine data (.atlas files)
329+ this . cache = null ;
330+ this . spineTextures = null ;
331+ this . json = null ;
332+ this . textures = null ;
333+ this . skeletonRenderer = null ;
334+ this . gl = null ;
335+ this . mvp = null ;
336+ this . shader = null ;
337+ this . batcher = null ;
338+ this . debugRenderer = null ;
339+ this . debugShader = null ;
323340 }
324341
325342} ) ;
0 commit comments