# Empty Tile.getTileData

**URL:** <https://phaser.discourse.group/t/empty-tile-gettiledata/5189>\
**Category:** Phaser 3\
**Created:** [February 14, 2020, 7:40pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189 "2020-02-14T19:40:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manz](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/manz/32/2658_2.png) [@Manz](https://phaser.discourse.group/u/Manz)\
**Post date:** [February 14, 2020, 7:40pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189/1 "2020-02-14T19:40:21Z")

</div>

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:

```javascript
"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](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/d/d0790cbb524f44538e5329f416d753c23780edb9.png)

How can I get `type` value for index?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 14, 2020, 8:16pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189/2 "2020-02-14T20:16:52Z")

</div>

Isn’t it

```
tileset.getTileProperties(index).type

```

? I think `getTileData()` is some other data.

---

<div class="post-metadata">

**Author:** ![Manz](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/manz/32/2658_2.png) [@Manz](https://phaser.discourse.group/u/Manz)\
**Post date:** [February 14, 2020, 8:25pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189/3 "2020-02-14T20:25:30Z")

</div>

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

![image](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/8/896a03ad34b6ae8aabec8a443d8b7ce6cde823f1.png)

But, I want this data:

![image](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/4/4dabfea5735e0b9b30b6829774681c6133464a9c.png)

`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](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/4/4f13e249d18ce2998e95a7365967f0de148db31d.png)

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

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 14, 2020, 9:52pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189/4 "2020-02-14T21:52:06Z")

</div>

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

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

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

---

<div class="post-metadata">

**Author:** ![Manz](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/manz/32/2658_2.png) [@Manz](https://phaser.discourse.group/u/Manz)\
**Post date:** [February 14, 2020, 10:04pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189/5 "2020-02-14T22:04:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 14, 2020, 11:36pm UTC](https://phaser.discourse.group/t/empty-tile-gettiledata/5189/6 "2020-02-14T23:36:53Z")

</div>

I think you’re right. In [game objects/tilemap/tests/semi automated tests](http://localhost:8080/edit.html?src=src/game%20objects%5Ctilemap%5Ctests%5Csemi%20automated%20tests.js) (line 1477) `getTileData()` does work that way.
