In my scene preload()
method i have loaded alot of images etc for example;
preload() {
this.load.image(‘back-arrow’, ‘…/back-arrows.png’);
}
Flow of our app is to destroy the game instance and re initialize it …
our game configuration is following
const config = {
type: Phaser.WEBGL,
backgroundColor: ‘#000’,
resolution: window.devicePixelRatio,
scale: {
// The game will be scaled manually in the resize()
mode: Phaser.Scale.NONE,
width: DEFAULT_WIDTH,
height: DEFAULT_HEIGHT,
// width: window.screen.width * window.devicePixelRatio,
// height: window.screen.height * window.devicePixelRatio,
orientation: Phaser.Scale.Orientation.LANDSCAPE,
// autoCenter: Phaser.Scale.CENTER_BOTH,
parent: ‘game-div’,
fullscreenTarget: ‘game-div’
},
dom: {
createContainer: true
},
scene: [
preloadScene,
mainScene
],
plugins: {
scene: [{
key: ‘SpineWebGLPlugin’,
plugin: window[‘SpinePlugin’],
mapping: ‘spine’
},
{
key: ‘dialogModal’,
plugin: DialogModal,
mapping: ‘dialogBox’
}]
},
physics: {
default: ‘arcade’,
arcade: {
debug: false,
gravity: { y: 2500 }
}
},
title: ‘My Game’,
transparent: true,
callbacks: {
// tslint:disable-next-line: no-shadowed-variable
postBoot: function (game) {
// console.debug(‘game.config’, game.config);
game.scene.dump();
}
}
}
this is causing memory leak …
please help