Hi folks, first time poster. I have a simple Tiled tilemap that has a tileset with 2 images. I can set the tiles and load the tilemap just fine in Phaser. However, when I attempt to set a tile programmatically, I get the following error:
Phaser v3.60.0 (WebGL | Web Audio) https://phaser.io
phaser.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading ‘tileWidth’)
at t.exports [as PutTileAt] (phaser.min.js:1:1076818)
I am using extremely simple code, I just grabbed an existing tile (I confirmed that the tile is non-null and set in the tilemap) and tried to set the same tile back in its place:
this.map = this.make.tilemap({ key: 'map'});
const tileset = this.map.addTilesetImage('tiles', 'map-tiles');
this.layer = this.map.createLayer("Tile Layer 1", tileset, 105, 160).setScale(1.6);
let tile = this.map.getTileAt(3,1);
this.map.putTileAt(tile, 3, 1, false, "Tile Layer 1"); <--- ERROR
I’ve also tried using just the tile index instead of the whole object, that does not work either.
I also notice that the example on Phaser’s own website that shows this functionality, gets the same error.
https://labs.phaser.io/view.html?src=src/tilemap\paint%20tiles.js
Any help would be appreciated.
Thanks!