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

Feedback ETA of mega chunk feature?

Discussion in 'Entity Component System' started by optimise, Dec 15, 2020.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,113
    Recently I keep getting this error and force me to move out some components as another entity which is quite annoying. Will mega chunk feature coming soon so I no longer need to fix this error anymore?

    ArgumentException: System.InvalidOperationException: Entity archetype component data is too large. Previous archetype size per instance {archetype->InstanceSizeWithOverhead} bytes. Attempting to add component size {componentInstanceSize} bytes. Maximum chunk size {chunkDataSize}.
     
  2. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    So you have an entity that has so much component data that it can't fit one entity in a chunk ?
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,113
    Ya.
     
  4. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    And you use all these components together in the same job ? or have combination of job that basically make all component relevant to each others ?

    If not, splitting it in multiple entity based on the set of component that are used in conjonction in job is probably a more performant approach even though it's like you said more annoying to manage.
     
    Last edited: Dec 15, 2020
  5. TheGabelle

    TheGabelle

    Joined:
    Aug 23, 2013
    Posts:
    242
  6. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    Eventually some games will evolve into things so big that although there is no one job that uses enough components to fill a chunk, there could be enough jobs that uses different parts of the same entity that fills a whole archetype.
    Excuse my terrible paint drawing but it should explain what I mean much easier than I can put into words. upload_2020-12-15_15-57-7.png
    I have no idea just how many components you need to fill a chunk archetype, and maybe you can totally avoid such situations with better architecture planning, but I guess it is bound to happen once you implement enough features, especially for entitles like the player character.
    So although very niche, and probably less than 10~ entities in any game would need, there existing a special chunk that just lets you put whenever many components you need could work, even though it opens the doors to terrible architectures
     
  7. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    969
    Another solution is to use another entity to hold some of the components then have a reference of it in the main entity. You can easily find the referenced entity using ComponentDataFromEntity.