phaser
phaser copied to clipboard
Tilemap objects property is not always an array (as it is typed)
When only empty object layers are added in Tiled, this is an empty object instead of an empty array.
https://github.com/photonstorm/phaser/blob/1a086fc57c8faa53885fd1a4e20d617b958d3677/src/tilemaps/Tilemap.js#L260
Suggested solution:
this.objects = Array.isArray(mapData.objects) ? mapData.objects : [];
Maybe a little short-sighted? On the other hand, my game crashed because I relied on the type comment.