Example #1
0
    protected override void OnUpdate()
    {
        var addOneTypeHandle   = GetComponentTypeHandle <AddOne>();
        var addTwoTypeHandle   = GetComponentTypeHandle <AddTwo>();
        var addThreeTypeHandle = GetComponentTypeHandle <AddThree>();
        var addFourTypeHandle  = GetComponentTypeHandle <AddFour>();

        var addAllJob = new AddAllJob
        {
            addOneTypeHandle   = addOneTypeHandle,
            addTwoTypeHandle   = addTwoTypeHandle,
            addThreeTypeHandle = addThreeTypeHandle,
            addFourTypeHandle  = addFourTypeHandle
        };

        Dependency = addAllJob.ScheduleParallel(m_AddSomethingGroup, Dependency);
    }
Example #2
0
    private static void TestIJob()
    {
        ExecuteJobOrJobParallelFor((values1, values2, results) =>
        {
            AddAllJob addAllJob1       = new AddAllJob();
            addAllJob1.adder           = 1;
            addAllJob1.values          = values1;
            JobHandle addAllJob1Handle = addAllJob1.Schedule();

            AddAllJob addAllJob2       = new AddAllJob();
            addAllJob2.adder           = 1;
            addAllJob2.values          = values2;
            JobHandle addAllJob2Handle = addAllJob2.Schedule();

            AddJob addJob = new AddJob();
            addJob.a      = values1;
            addJob.b      = values2;
            addJob.result = results;

            return(addJob.Schedule(JobHandle.CombineDependencies(addAllJob1Handle, addAllJob2Handle)));
        });
    }