Search Unity

Add an empty JobHandle as a dependency to other jobs

Discussion in 'Entity Component System' started by Bivens32, Jan 14, 2020.

  1. Bivens32

    Bivens32

    Joined:
    Jul 8, 2013
    Posts:
    36
    Conceptually, jobA needs to wait for jobB, but jobB is not actually a job. I need to do some work in a compute shader and return an empty JobHandle that has its Complete() method called when the compute shader has finished its calculations. Is there a way to make something like that work?

    Code (CSharp):
    1. JobHandle handle = new JobHandle();
    2. // make other jobs depend on this empty job handle
    3. return handle;
    4.  
    5. // Somewhere else in code call complete after a compute shader has finished
    6. handle.Complete();