Empty Tile.getTileData

Hi!

I build a tilemap & tileset with Tiled 1.3.2, export into JSON and get it into Phaser 3.22.0.

My first tileset have multiple tiles, for example:

"tiles": [
   { "id": 0, "imageheight": 32, "imagewidth": 32, "type": "floor" },
   { "id": 1, "imageheight": 32, "imagewidth": 32, "type": "wall", 
     "properties": [ { "name": "collide", "type": "bool", "value": true } ]
   },
   ...
]

When I try get properties with tileset.getTileProperties(index) all works fine.
When I try get type with tileset.getTileData(index) I get a empty undefined value. Inspect my JS tileset, I see that tileData object is empty:

image

How can I get type value for index?

Isn’t it

tileset.getTileProperties(index).type

? I think getTileData() is some other data.

With getTileProperties(index) I get a object with custom properties:

image

But, I want this data:

image

tileset.getTileProperties(index).type returns undefined because no exists type on Custom Properties.

I understand that tileset.getTileData() should return this data info (type, imagewidth, imageheight, etc…), but I don’t undertand why tileData object is empty or if I should do something…

This type is useful for me, why Tiled allow create Object Types:

image

With this, I can create type collections with properties set.

It’s possible Phaser doesn’t include that, but I don’t know. :slightly_frowning_face:

You may be able to copy it manually, if you can find it:

this.cache.tilemap.get('KEY').data

Great.

I can get this on tilemap cache correctly. It’s a bit depth complex, but works.

You know that information/data store tileset.getTileData() / tileData object ? I thought it was for that.

I think you’re right. In game objects/tilemap/tests/semi automated tests (line 1477) getTileData() does work that way.