Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Putting all blob references on a single component, vs separating out

Discussion in 'Entity Component System' started by AlexAdach, Aug 15, 2023.

  1. AlexAdach

    AlexAdach

    Joined:
    Jan 25, 2023
    Posts:
    24
    Hey,

    I know that there are likely very many complex factors that would change the answer here. But assuming I have a character config component, with many blob asset references as members. For example, I have a blobarray of structs that represents character movement properties.

    Does it make more sense to include the blob asset reference on my movement component, or keep it only on my character config component, and include the character config component in all of my queries?

    I guess it would mean additional component in the query overhead vs the additional memory from every character entity having the blob reference on it's movement component?

    BTW is there any good material to read on how to determine component memory footprint?

    Thanks!
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,292
    It depends whether there are many or just one character. Sometimes its better to keep data inside the chunk. Sometimes its better to move it away. As long as you've abstracted authoring data away from runtime data, it shouldn't really matter since you can refactor it later on.

    In theory, blobs should be slower to iterate. Since data is not in the chunks and required to be fetched from different memory location. But in reality - it usually does not matter. It boils down to entity numbers.

    So, whatever works better and requires less code to write.

    Archetypes window, as well as Profiler's Entities Memory module should display that.