Search Unity

Tag components and dependency separation

Discussion in 'Entity Component System' started by snacktime, Sep 9, 2021.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Wanting to do a sanity check here to make sure this will work. If using tag components to partition entity data, will anything prevent two lambda jobs with the same component set but just the tag being different from running in parallel to each other?

    Assuming no other dependencies like containers, etc..
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    Yes. The safety system doesn't know that an entity doesn't have both tags. So this is not allowed. You can use IJobEntityBatch to get around this.
     
  3. Rupture13

    Rupture13

    Joined:
    Apr 12, 2016
    Posts:
    131
    Isn't this what
    .WithAny<Tag1, Tag2>()
    is for?
     
  4. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I want one job per tag. Parallelism at the job level.