Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TilemapLayer.destroy() doesn't cleanup Tilemap layer name cache #4319

Closed
APXEOLOG opened this issue Jan 26, 2019 · 1 comment
Closed

TilemapLayer.destroy() doesn't cleanup Tilemap layer name cache #4319

APXEOLOG opened this issue Jan 26, 2019 · 1 comment

Comments

@APXEOLOG
Copy link

Version

  • Phaser Version: Phaser v3.15.1-FB (WebGL | Web Audio)
  • Operating system: Windows 10

Description

The only wat to remove specific TilemapLayer from the Tilemap is to call TilemapLayer.destroy(). While it removes the layer visually, it doesn't remove itself from the Tilemap.layers cache. Later you cannot add layer with the same name again Image

Example Test Code

let map = this.make.tilemap({
      width: 10,
      height: 10,
      tileWidth: 32,
      tileHeight: 32
    });
let tileset = map.addTilesetImage("tiles", "tiles", 32, 32, 0, 2);
let layer = map.createBlankDynamicLayer('test', tileset, 0, 0);
layer.destroy()
map.createBlankDynamicLayer('test', tileset, 0, 0); <-- Error

Additional Information

As a workaround i manually remove name when destroy layer
Vue.delete(map.layers, map.getLayerIndexByName(layerName));

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants