diff --git a/spine-ts/index.html b/spine-ts/index.html
index cbee081a6..99bd0ec89 100644
--- a/spine-ts/index.html
+++ b/spine-ts/index.html
@@ -83,6 +83,9 @@
>Render to texture test
+
+ Custom object type
+
Player
diff --git a/spine-ts/spine-phaser/example/custom-spine-object-type.html b/spine-ts/spine-phaser/example/custom-spine-object-type.html
new file mode 100644
index 000000000..07b1bf8aa
--- /dev/null
+++ b/spine-ts/spine-phaser/example/custom-spine-object-type.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+ Spine Phaser Example
+
+
+
+ Basic example
+
+
+
+
\ No newline at end of file
diff --git a/spine-ts/spine-phaser/src/SpineGameObject.ts b/spine-ts/spine-phaser/src/SpineGameObject.ts
index 38b8af095..cadfdbaff 100644
--- a/spine-ts/spine-phaser/src/SpineGameObject.ts
+++ b/spine-ts/spine-phaser/src/SpineGameObject.ts
@@ -212,7 +212,7 @@ export class SpineGameObject extends DepthMixin(
atlasKey: string,
public boundsProvider: SpineGameObjectBoundsProvider = new SetupPoseBoundsProvider()
) {
- super(scene, SPINE_GAME_OBJECT_TYPE);
+ super(scene, (window as any).SPINE_GAME_OBJECT_TYPE ? (window as any).SPINE_GAME_OBJECT_TYPE : SPINE_GAME_OBJECT_TYPE);
this.setPosition(x, y);
this.premultipliedAlpha = this.plugin.isAtlasPremultiplied(atlasKey);
diff --git a/spine-ts/spine-phaser/src/SpinePlugin.ts b/spine-ts/spine-phaser/src/SpinePlugin.ts
index 040a3f2c8..3c107b36a 100644
--- a/spine-ts/spine-phaser/src/SpinePlugin.ts
+++ b/spine-ts/spine-phaser/src/SpinePlugin.ts
@@ -28,7 +28,7 @@
*****************************************************************************/
import Phaser from "phaser";
-import { SPINE_ATLAS_CACHE_KEY, SPINE_CONTAINER_TYPE, SPINE_GAME_OBJECT_TYPE, SPINE_SKELETON_DATA_FILE_TYPE, SPINE_ATLAS_FILE_TYPE, SPINE_SKELETON_FILE_CACHE_KEY as SPINE_SKELETON_DATA_CACHE_KEY } from "./keys";
+import { SPINE_ATLAS_CACHE_KEY, SPINE_GAME_OBJECT_TYPE, SPINE_SKELETON_DATA_FILE_TYPE, SPINE_ATLAS_FILE_TYPE, SPINE_SKELETON_FILE_CACHE_KEY as SPINE_SKELETON_DATA_CACHE_KEY } from "./keys";
import { AtlasAttachmentLoader, GLTexture, SceneRenderer, Skeleton, SkeletonBinary, SkeletonData, SkeletonJson, TextureAtlas } from "@esotericsoftware/spine-webgl"
import { SpineGameObject, SpineGameObjectBoundsProvider } from "./SpineGameObject";
import { CanvasTexture, SkeletonRenderer } from "@esotericsoftware/spine-canvas";
@@ -138,7 +138,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
}
return Phaser.GameObjects.BuildGameObject(this.scene, gameObject, config);
}
- pluginManager.registerGameObject(SPINE_GAME_OBJECT_TYPE, addSpineGameObject, makeSpineGameObject);
+ pluginManager.registerGameObject((window as any).SPINE_GAME_OBJECT_TYPE ? (window as any).SPINE_GAME_OBJECT_TYPE : SPINE_GAME_OBJECT_TYPE, addSpineGameObject, makeSpineGameObject);
}
boot () {
@@ -188,8 +188,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
}
gameDestroy () {
- this.pluginManager.removeGameObject(SPINE_GAME_OBJECT_TYPE, true, true);
- this.pluginManager.removeGameObject(SPINE_CONTAINER_TYPE, true, true);
+ this.pluginManager.removeGameObject((window as any).SPINE_GAME_OBJECT_TYPE ? (window as any).SPINE_GAME_OBJECT_TYPE : SPINE_GAME_OBJECT_TYPE, true, true);
if (this.webGLRenderer) this.webGLRenderer.dispose();
}
diff --git a/spine-ts/spine-phaser/src/keys.ts b/spine-ts/spine-phaser/src/keys.ts
index c1761f2ea..f8d01d223 100644
--- a/spine-ts/spine-phaser/src/keys.ts
+++ b/spine-ts/spine-phaser/src/keys.ts
@@ -33,4 +33,3 @@ export const SPINE_LOADER_TYPE = "spine";
export const SPINE_SKELETON_DATA_FILE_TYPE = "spineSkeletonData";
export const SPINE_ATLAS_FILE_TYPE = "spineAtlasData";
export const SPINE_GAME_OBJECT_TYPE = "spine";
-export const SPINE_CONTAINER_TYPE = "spineContainer";