Job Dependencies Question

Im having a bit of trouble getting my job dependency to work.

I trying to run SetTiles() then SetTriangles() then SetTileTriangles() with SetTriangleNeighbors().

My fist attempt was to combine SetTiles() & SetTileTriangles() JobHandles and pass that to both SetTileTriangles() AND SetTriangleNeighbors() but didnt work. Ive never done
var dependency = JobHandle.CombineDependencies(jobAHandle, jobBHandle); and not sure if it even work in JobComponentSys.

Also not clear to me what im suppose to return and pass to AddJobHandleForProducer and i assuming I want to remove ScheduleSingle from the last two jobs

        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {

            inputDeps = new SetTiles()
            {
                ecb = ecbs.CreateCommandBuffer().ToConcurrent(),
                eTiles = qTiles.ToEntityArray(Allocator.TempJob)

            }.ScheduleSingle( qTileBuffer, inputDeps);


            inputDeps = new SetTriangles()
            {
                ecb = ecbs.CreateCommandBuffer().ToConcurrent(),
                eTiles = qTiles.ToEntityArray(Allocator.TempJob),
                eTriangles = qTriangles.ToEntityArray(Allocator.TempJob)

            }.ScheduleSingle( qTrianglesBuffer, inputDeps);


            inputDeps = new SetTileTriangles()
            {
                ecb = ecbs.CreateCommandBuffer().ToConcurrent(),
                eTiles = qTiles.ToEntityArray(Allocator.TempJob),
                eTriangles = qTriangles.ToEntityArray(Allocator.TempJob)

            }.ScheduleSingle( qTileBuffer, inputDeps);


            inputDeps = new SetTriangleNeighbors()
            {
                ecb = ecbs.CreateCommandBuffer().ToConcurrent(),
                eTriangles = qTriangles.ToEntityArray(Allocator.TempJob)

            }.ScheduleSingle( qTrianglesBuffer, inputDeps);


            ecbs.AddJobHandleForProducer(inputDeps);
            inputDeps.Complete();

            return inputDeps;
        }

How you’re queueing your jobs seems fine (except for the complete), though I’m curious why they all need to be ScheduleSingle.

What’s your error? I suspect your ToEntityArray is causing you the issues

1 Like