Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Tagging or marking entities

Discussion in 'Entity Component System' started by andynayrb, Jan 8, 2020.

  1. andynayrb

    andynayrb

    Joined:
    Feb 28, 2019
    Posts:
    25
    Okay, so I have about 250 floor tiles. If my character steps on certain tiles then I want to change something about the character.

    I assume that I need to do a CollisionCast or RayCast to check for certain tiles.

    So what would be the best way to mark the tiles (entities) so that they could be found by a query? Looking online I have seen tag components (empty components) added to only a few of the tiles. Or I could add a component to all the tiles with a bool in it to check.

    I could see adding a tag component as theoretically being a better option because there would be fewer results to filter through. On the other hand I don't really know the cost of adding more components to entities. Is there a point where you would lose performance because you have to many components on an entity? If so, about what number of components should you try to stay under?

    So I guess there were a lot of questions. Thanks in advance.