-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Remove Texture and Reload it with same Key do not work #4720
Copy link
Copy link
Closed
Labels
Description
Version
- Phaser Version: v3.17.0
- Operating system: Mac OS
- Browser:
Description
Load an atlas with key1.
Remove that atlas.
Reload that atlas with key1, it's not working.
Example Test Code
var config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload() {
this.load.path = 'assets/atlas/';
this.load.multiatlas('megaset', 'tp3-multi-atlas.json');
}
function create() {
this.bunny = this.add.image(300, 130, 'megaset', 'bunny').setOrigin(0); // un-trimmed
this.bunny.destroy();
this.textures.remove('megaset');
// Will not work because texture key is the same
this.load.multiatlas('megaset', 'tp3-multi-atlas.json');
this.load.once('complete', () => {
console.log('load complete');
this.bunny = this.add.image(300, 130, 'megaset', 'bunny').setOrigin(0);
});
this.load.start();
// Will work because key is different
this.load.multiatlas('megaset2', 'tp3-multi-atlas.json');
this.load.once('complete', () => {
console.log('load complete2');
this.bunny = this.add.image(300, 130, 'megaset2', 'bunny').setOrigin(0);
});
this.load.start();
}
Additional Information
You can paste the example code here to have it run directly : https://labs.phaser.io/edit.html?src=src/textures\multi%20atlas.js
Reactions are currently unavailable