Example #1
0
    private void Update()
    {
        inputValue  = new NativeArray <int>(arraySize, Allocator.TempJob);
        outputValue = new NativeArray <int>(arraySize, Allocator.TempJob);
        var job = new BackgroundForJobWithInputOutputParams
        {
            InputValue  = inputValue,
            OutputValue = outputValue
        };

        // Schedule entire for job on a single background thread
        backgroundJobHandle = job.Schedule(inputValue.Length, new JobHandle());
    }
Example #2
0
    private void Update()
    {
        inputValue  = new NativeArray <int>(arraySize, Allocator.TempJob);
        outputValue = new NativeArray <int>(arraySize, Allocator.TempJob);
        var job = new BackgroundForJobWithInputOutputParams
        {
            InputValue  = inputValue,
            OutputValue = outputValue
        };

        // schedule individual batches of the for job on separate threads, each processing "innerloopBatchCount" items of the collection
        backgroundJobHandle = job.ScheduleParallel(inputValue.Length, arraySize / 100, new JobHandle());
    }