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

ecb.SetComponent single thread?

Discussion in 'Entity Component System' started by kro11, May 8, 2021.

  1. kro11

    kro11

    Joined:
    Sep 23, 2019
    Posts:
    95
    Is "SetComponent" part executed in one thread? There are no structural changes here.
    Code (CSharp):
    1. ecb.Instantiate
    2. ecb.SetComponent
    If yes, then is there a way to set values immediately after entity creation in parallel?
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,984
    ecb.Instantiate is a structural change. Everything in the ecb is played back in a single thread.

    Are you facing some kind of performance bottleneck?
     
  3. kro11

    kro11

    Joined:
    Sep 23, 2019
    Posts:
    95
    Yes, I know. I am asking about ecb.SetComponent. There are only 5 options structural changes in manual:
    • Creating entities
    • Deleting entities
    • Adding components to an entity
    • Removing components from an entity
    • Changing the value of shared components
    Just wanted to know if it is possible to assign values in parallel after creating an entity in some way?

    Yes, EndSimulationEntityCommandBufferSystem reaches up to 6ms.
     
  4. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,984
    kro11 and adammpolak like this.