Entities tree and marker components
When a map is loaded, it spawns a lot of entities: for the map, for layers, for tiles, for objects, for colliders, ... These entites are organized in a parent / child hierarchy.
It notably brings the capability to inherit some of the component down the tree.
For instance, if you change the Visibility
of an entity, it will automatically apply to all entities below in the hierarchy.
It also helps to keep things nice and clean.
Tree hierarchy
Map
At the top of the tree, there is the map.
It notably holds the TiledMapHandle
pointing to your .TMX file and all the settings that apply to it.
It can be easily identified using a dedicated marker component: TiledMapMarker
.
Layers
Below the map, we have the layers. They can be of different kinds, which each have their own marker component:
TiledMapObjectLayer
: for objects layer.TiledMapTileLayer
: for tiles layer.TiledMapGroupLayer
: for group layer (not supported for now).TiledMapImageLayer
: for image layer (not supported for now).
All of them are also identified by the same generic marker: TiledMapLayer
.
Objects & Tiles
Objects are directly below their TiledMapObjectLayer
.
They are identified by a TiledMapObject
marker.
For tiles, it's a little more complicated.
Below the TiledMapTileLayer
, we first have one TiledMapTileLayerForTileset
per tileset in the map.
Finally, below these, we find the actual TiledMapTile
which correspond to every tiles in the layer, for a given tileset.
Physics colliders
At the end of the hierarchy, we find physics colliders.
They are spawned below they "source", ie. either a tile or an object and can be identified using their marker component: TiledColliderMarker
.