Search Unity

Can system execute same job multiple times, before this job is finished?

Discussion in 'Entity Component System' started by Antypodish, Sep 26, 2019.

  1. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    This question is somehow related to my previous thread
    How stable is actually determinism for busy systems?
    But decided to keep it separate.

    So question:
    Can system execute same job multiple times, before this job is finished?

    Lets say, I got system with a job, which creates n entities.
    It requires 2 to 4 frames to execute.
    For this particular scenario, I call this system manually every frame.
    Meaning I call job every frame.
    Would that mean, I create n set of entities multiple times?

    If so, that may be potentially problematic, when EntityCommandBuffer is involved.

    If that is the case, any thoughts how to prevent multiple system/jobs calls?


    Update:
    See proposed solution

     
    Last edited: Sep 27, 2019
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Antypodish likes this.
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    Ah, yes I have seen this thread, but haven't read initially. Now I did.
    Your responses confirms my concerns and my observations.
    As you primarily suggested in the link, one way is to reduce number of entities in ECB.
    But that wont guarantee stability (none duplications of data), since I try to fast forward simulation.
    Managing of the job handle is my current direction, I look at indeed.
    Than you for pointing out.

    On side note, I think you have posted in the past (can not find it :oops:), regarding putting job handle in array, or list? Not sure however, if was that about actual job handle, or was rather manual system update, which we discussed recently anyway. Or maybe it was something completely in different context. Can you recall anything relevant?
    I am starting loose my mind? :p
     
    Last edited: Sep 26, 2019