Search Unity

A 2D map made of square tiles, best approach?

Discussion in 'Entity Component System' started by Goldseeker, Jul 17, 2018.

  1. Goldseeker

    Goldseeker

    Joined:
    Apr 2, 2013
    Posts:
    42
    I'm thinking about civ-like game and wondering what is Unity ECS approach to store the tiles.
    • One way is to use Shared component with position inside to mark entities that are located on the tile(the entities can be terrain type entitiy, units on the terrain, anything), Filtering entities by SharedComponent should be fast and good for most cases except for passfinding where you need a lot of random access
    • The other way is to find a way to store an array of entities somewhere (I've read in changelog that now it is possible to somehow store arrays - yay!) and just use it for random access to tile entities when needed
    What do you think?
     
    S_Darkwell likes this.