版本:Unity 6 (6000.0)
语言英语
  • C#

ProfilerFlowEventType.Next

建议更改

成功!

感谢您帮助我们提升 Unity 文档质量。尽管我们无法接受所有反馈,但我们会阅读用户提出的每个建议更改,并在适用的情况下进行更新。

关闭

提交失败

由于某些原因,无法提交您建议的更改。请在几分钟后<a>重试</a>。感谢您花时间帮助我们提升 Unity 文档质量。

关闭

取消

说明

用于流程继续点。

流程开始点的一个示例是作业调度。例如,IJobExtensions.Schedule 会生成一个隐式的 Begin Profiler 流程事件,而 IJob.Execute 会生成一个隐式的 Next 事件。

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

public class Example { static readonly ProfilerMarker k_ScheduleTasksMarker = new ProfilerMarker("Schedule Task"); static readonly ProfilerMarker k_TaskMarker = new ProfilerMarker("Task");

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

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