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 VFX Representation of Entity.

Discussion in 'DOTS Dev Blitz Day 2023 - Q&A' started by AlexAdach, Aug 24, 2023.

  1. AlexAdach

    AlexAdach

    Joined:
    Jan 25, 2023
    Posts:
    24
    Hi!

    Thank you for all of your hard work. I love DOTS, I love seeing thousands of physics enabled entities interacting with each other and looking over and seeing 250+ fps on the editor stats window. It's incredibly satisfying. I have a few questions/comments that come to mind.

    1. What's the best practice for instantiating an entity with a large amount of components? Currently I've got a job that adds all the needed components and sets their init values and enabled states. This seems awfully verbose. Should I create a blob reference for an architype definition and use that? ... or something like that?
    2. Do you have recommendations on how to utilize VFX graph with ECS? Specifically if you want a vfx to be tied to an entity? I tried direct-link events, but am now settling on graphics buffers. Wondering what the recommendation is. I read that constantly writing to the GPU is bad practice, but would it really be that much of a performance hit if the only data I'm writing is just entity position data? Maybe a few thousand entities at most?
    3. Building off of 2, I'm having a monobehavior read a system component data. The system has a bunch of native arrays that get populated with ToComponentDataArray. Which allocator should I use for the monobehavior to be able to read that data and process it(like turn it into a graphics buffer). Does it make more sense to copy that nativearray data, or perhaps cast it to an unsafe array or as read only? Should I be disposing of the native array after it's read in the monobehavior or in the system? Does it matter?
    4. Is there an event that gets called once default world is created that a monobehavior can subscribe to?
    5. How can I calculate how large a component is? Is there a reference for how many bytes each data type takes up? Are there any cheat sheets/documents out there that can guide me on how best to architect my components?
    6. How many components is too many components?
    I know I have more but I just remembered this conversation was happened and I'm blanking.

    Anyway thanks again!
     
  2. AlexAdach

    AlexAdach

    Joined:
    Jan 25, 2023
    Posts:
    24
    Oh! I find that it's kind of hard to know which component types are supported in ECS natively and which are not. Is there like a master list of what is "bakeable" and what is not?