---
title: 播放模式和 Editor 配置文件样本
product: Unity Editor
version: '6000.0'
latest_version: '7000.0'
status: This page documents version 6000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/zh-cn/engine/6000.0/manual/analysis/profiler/play-edit-samples
latest_url: https://docs.unity.com/zh-cn/engine/7000.0/manual/analysis/profiler/play-edit-samples.md
last_updated: 2026-09-14
generated_at: 2026-11-20T20:44:19.586Z
locale: zh-cn
---

# 播放模式和 Editor 配置文件样本

> 了解播放模式下收集的性能分析数据与 Editor 中收集的数据之间的差异。

当您对 Unity Editor 或播放模式进行配置文件时，Unity 会将它们的相关时间组为具有[以下 Markers](/engine/6000.0/manual/analysis/profiler/markers.md) 的两个样本组：

* `PlayerLoop`：与播放模式相关的时间
* `EditorLoop`：与 Editor 相关的时间

## 播放模式样本##play-mode-samples

当您配置文件播放模式时，性能分析器仅收集在`PlayerLoop`内发生的时序样本。该组有助于减少 [CPU](/engine/6000.0/manual/analysis/profiler/visualizing-data/cpu/cpu.md) 和 [GPU 性能分析器模块](/engine/6000.0/manual/analysis/graphics-performance-profiling/profile-rendering/profiler-gpu.md)中的误导性测量的量。

Unity 在 [CPU 性能分析器模块图表](/engine/6000.0/manual/analysis/profiler/visualizing-data/cpu/cpu.md)中将 Any `EditorLoop` 样本归类为 **Other**，这意味着 `EditorLoop` 样本是 **Other** Category 的最大贡献者。如果您想查找 Editor 在此时间内执行的操作并详细了解对 **Other** Category 的贡献，请[对 Editor 过程进行](/engine/6000.0/manual/analysis/profiler/profiling-applications/profiling-edit-mode.md)配置文件。

> **Important:**
>
> 如果使用[深度性能分析](/engine/6000.0/manual/analysis/profiler/deep-profiling.md)和目标播放模式，则会对 `PlayerLoop` 和 `EditorLoop` 中发生的每次调用产生性能影响。这是因为深度性能分析挂接到域重新加载时任何脚本方法调用的开头和结尾，并且不会检测从未从`PlayerLoop`调用过哪些部分。在`EditorLoop`中发生的方法 Calls 不具有创建样本的全部开销，但它们仍然检查是否发射样本，因此开销较小。

## Editor 样本##editor-samples

当您对 [Editor 进程进行](/engine/6000.0/manual/analysis/profiler/profiling-applications/profiling-edit-mode.md)配置文件时，以前隐藏在`EditorLoop`标记下的所有样本都会贡献到各自的类别中。这意味着 [CPU 性能分析器模块的细节面板](/engine/6000.0/manual/analysis/profiler/visualizing-data/cpu/cpu.md)及其图表中的信息会显著变化。

某些[性能分析器 Markers](/engine/6000.0/manual/analysis/profiler/markers.md) 仅在[在 Unity Editor](/engine/6000.0/manual/analysis/profiler/profiling-applications/profiling-edit-mode.md) 中进行配置文件时才会出现。这些 Markers 不会出现在 Player 相关练习中，仅与 Editor 练习相关。仅限 Editor 的 Markers 包括：

* SECURITY 检查类似于 GetComponentNullErrorWrapper，有助于识别 null 组件使用情况。
* CheckConsistency，用于验证 Object 设置。
* CheckAllowDestructionRecursive，这是销毁检查。
* 预制件相关活动。

默认情况下，在 [CPU Profiler 模块 **的 Hierarchy** 视图](/engine/6000.0/manual/analysis/profiler/visualizing-data/cpu/cpu.md)中，具有仅限 Editor 标记的样本栈会折叠并命名 `EditorOnly [SampleName]`为 。虽然这些样本栈或其子样本可能会导致可以触发器垃圾收集的 Managed 分配，但如果它们被折叠，则不会影响其父样本的`GC.Alloc`值。

要更改默认行为，请在模块细节面板的右上角选择上下文菜单并禁用 [Collapse EditorOnly 样本](/engine/6000.0/manual/analysis/profiler/visualizing-data/cpu/cpu.md)设置。当您这样做时，您可以展开样本并将其`GC.Alloc`值贡献给包围标记。

此选项不影响**时间轴** View，样本及其子对象看起来已展开。通常可以忽略带有这些 Markers 的样本，因为它们与仅 Editor 的活动相关，并且对减少 Managed 分配没有 Any 影响。但是，它们可用于调查它们ON播放模式是否有显著的性能影响。

## 其他资源##additional-resources

* [在播放模式下收集性能数据](/engine/6000.0/manual/analysis/profiler/profiling-applications/profiling-play-mode.md)
* [收集有关 Unity Editor 的性能数据](/engine/6000.0/manual/analysis/profiler/profiling-applications/profiling-edit-mode.md)
* [CPU 使用率性能分析器模块](/engine/6000.0/manual/analysis/profiler/visualizing-data/cpu/cpu.md)
* [性能分析器 Markers 参考](/engine/6000.0/manual/analysis/profiler/markers.md)
