Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

SharedDataComponent and Different ArcheTypes\Chunks

Discussion in 'Entity Component System' started by mike1997, May 3, 2021.

  1. mike1997

    mike1997

    Joined:
    Jul 1, 2016
    Posts:
    25
    This is most likely a very simple question about organizing entities
    Based on the docs, sharedDataComponents divide the entities into different chunks.

    Doc: When you add a shared component to an entity, the EntityManager places all entities with the same shared data values into the same Chunk. archetype

    But what about having a SharedDataComponent that is in many different Archtypes, I made sure to have many little DataComponents, and add these to units based on their ability. Would having the same SharedDataComponent on many different Archtypes be smart?

    What about looking through all the entities with that SharedDataComponent, this will require going to many different chunks is that ok, or is it an anti-pattern?


    thx for all the help

    Mike
     
  2. Micz84

    Micz84

    Joined:
    Jul 21, 2012
    Posts:
    451
    You would need to write what exactly you weren't too archive. If it causes poor chunks utilisation it may be a cause of cache misses, so performance will be worse. But if your chunks are mostly full then if you so not change shared component data to often then it should be OK. Remember most important rule in DoD is think about data sand how it will be transformed.