Ejemplo n.º 1
0
    protected void LaunchJobParallel()
    {
        init   = true;
        result = new NativeArray <int>(num, Allocator.Persistent);
        FibonacciJob fibJob = new FibonacciJob(num, ref result);
        CalcWithFibonacciParallel calcWitJob = new CalcWithFibonacciParallel(2, ref result);

        handle       = fibJob.Schedule();
        secondHandle = calcWitJob.Schedule(num, 100, handle);
    }
Ejemplo n.º 2
0
    protected void LaunchJob()
    {
        int num = 1000;
        NativeArray <int> result = new NativeArray <int>(num, Allocator.TempJob);
        FibonacciJob      fibJob = new FibonacciJob(num, ref result);
        JobHandle         handle = fibJob.Schedule();

        handle.Complete();
        for (int i = 0; i < num; ++i)
        {
            Debug.Log(result[i]);
        }
        result.Dispose();
    }