# ParallelNext

> Use for the parallel flow continuation point.

## Definition

* **Type:** Field
* **Namespace:** [Unity.Profiling](/engine/6000.7/script-reference/unity/profiling.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
ParallelNext = 1
```

### Remarks

All parallel flow instances are equivalent and connected to the same [ProfilerFlowEventType.Begin](/engine/6000.7/script-reference/unity/profiling/profilerfloweventtype/begin.md) or [ProfilerFlowEventType.Next](/engine/6000.7/script-reference/unity/profiling/profilerfloweventtype/next.md) events that happened previously. An example of a flow start point is job scheduling. For instance, [IJobParallelForExtensions.Schedule](/engine/6000.7/script-reference/unity/jobs/ijobparallelforextensions/schedule.md) generates an implicit [ProfilerFlowEventType.Begin](/engine/6000.7/script-reference/unity/profiling/profilerfloweventtype/begin.md) Profiler flow event and [IJobParallelFor.Execute](/engine/6000.7/script-reference/unity/jobs/ijobparallelfor/execute.md) generates an implicit [ProfilerFlowEventType.ParallelNext](/engine/6000.7/script-reference/unity/profiling/profilerfloweventtype/parallelnext.md) event.

```csharp
using System;
using System.Threading;
using Unity.Profiling;
using Unity.Profiling.LowLevel;
using Unity.Profiling.LowLevel.Unsafe;

public class Example
{
    static readonly ProfilerMarker k_ScheduleParallelTasksMarker = new ProfilerMarker("Schedule Parallel Tasks");
    static readonly ProfilerMarker k_ParallelTaskMarker = new ProfilerMarker("Parallel Task");

    static void EmitFlowEventAndChainThread(uint flowId)
    {
        // Mark the next k_ParallelTaskMarker as a beginning of the flow
        ProfilerUnsafeUtility.FlowEvent(flowId, ProfilerFlowEventType.ParallelNext);
        using (k_ParallelTaskMarker.Auto())
        {
            // Do work
        }
    }

    static void ScheduleParallelTask()
    {
        using (k_ScheduleParallelTasksMarker.Auto())
        {
            var flowId = ProfilerUnsafeUtility.CreateFlow(ProfilerUnsafeUtility.CategoryScripts);
            // Mark the parent k_ScheduleParallelTasksMarker as a beginning of the flow
            ProfilerUnsafeUtility.FlowEvent(flowId, ProfilerFlowEventType.Begin);
            var thread = new Thread(() => EmitFlowEventAndChainThread(flowId));
            thread.Start();
        }
    }
}
```

Additional Resources: [ProfilerUnsafeUtility.FlowEvent](/engine/6000.7/script-reference/unity/profiling/lowlevel/unsafe/profilerunsafeutility/flowevent.md).
