Tag - Quillraven/Fleks GitHub Wiki

Fleks 2.5 introduced a new special kind of component called EntityTag. A tag is basically a component that has no data. It is just used to flag an entity with a specific piece of information. This could be e.g. a "visibility", "player controlled" or other kind of information. The difference to a component is that a tag is stored in a more memory efficient way. It should be preferred over components with no data.

Here is an example on how you can define a tag:

// Tag to mark entities that are visible
data object Visible : EntityTag()

Tags can also be created as enum class using the entityTagOf function:

enum class MyTags : EntityTags by entityTagOf() {
    PLAYER, VISIBLE
}

Other than that, tags follow the same syntax as components meaning that you can check for an existence of a tag with the has function and you can also use them for family definitions.