nkholski/phaser-animated-tiles

Plugin crash if map contains an unused layer.

Thomas-lhuillier opened this issue · 1 comments

When using the plugin with a map containing an unused layer (eg. only used on server side), the plugins throws an error.

Uncaught TypeError: Cannot read property 'type' of null.

I use this code (before animatedTiles.init(map)) to avoid this issue

map.layers.forEach((layer) => {
                if (layer.tilemapLayer === null) {
                    layer.tilemapLayer = {type: 'StaticTilemapLayer'}
                }
            })