Unity_Addressable_Event Viewer(事件查看器)
Use the Addressables Event Viewer window to monitor memory management of your Addressables assets. The window shows when your application loads and unloads assets and displays the reference counts of all Addressables system operations. The window also shows approximate views of the application frame rate and the total amount of allocated managed memory. You can use these charts to detect how Addressables events such as loading and releasing assets affect application performance and to detect assets that you never release.
译:使用 Addressables 事件查看器窗口来监视您的 Addressables 资产的内存管理。该窗口显示了应用程序何时加载和卸载资产,并显示所有 Addressables 系统操作的引用计数。该窗口还显示了应用程序帧率和已分配托管内存总量的近似视图。您可以使用这些图表来检测 Addressables 事件(例如加载和释放资产)如何影响应用程序性能,并检测您从未释放的资产。
Use the Use Existing Build Play Mode script to get the most accurate information in the Event Viewer in Play mode. The Use Asset Database script doesn't account for any shared dependencies among the Assets and the Simulate Groups script gives a less accurate monitoring of reference counts.
译:在 Play 模式下,使用现有构建 Play Mode 脚本以获取事件查看器中最准确的信息。Use Asset Database 脚本不考虑任何资产之间的共享依赖关系,而 Simulate Groups 脚本则提供了对引用计数的较不准确的监视。
IMPORTANT
To view data in the Event Viewer, you must enable the Send Profiler Events setting in your AddressableAssetSettings object's Inspector and make a new content build.
译:要在事件查看器中查看数据,必须启用 AddressableAssetSettings 对象的 Inspector 中的 Send Profiler Events 设置,并进行新内容构建。
See Memory management for more information about managing the memory associated with your Addressable assets.
译:有关管理与您的 Addressable 资产相关的内存的更多信息,请参见内存管理。
Viewing Addressables events
View Addressables asset lifespan charts and events in the Event Viewer window:
译:在事件查看器窗口中查看 Addressables 资产寿命图表和事件:
Enable Send Profiler Events in your Addressables settings:在 Addressables 设置中启用 Send Profiler Events:
Open your Addressable settings Inspector (menu: Window > Asset Management > Addressables > Settings)打开 Addressable 设置的 Inspector(菜单:Window > Asset Management > Addressables > Settings)
Under Diagnostics, check the Send Profiler Events option.译:在诊断下,勾选发送 Profiler 事件选项
Rebuild your Addressables content using the Default Build Script from the Addressables Groups window.译:使用 Addressable Groups 窗口中的默认构建脚本重新构建您的 Addressables 内容
Open the Event Viewer (menu: Window > Asset Management > Addressables > Event Viewer).译:打开事件查看器(菜单:Window > Asset Management > Addressables > Event Viewer)
Enter Play mode in the Editor.译:在编辑器中进入 Play 模式
Viewing Addressables events in a standalone player
To connect the Event Viewer to a standalone player, follow the steps under Viewing Addressables Events except for the last step where you enter Play mode in the Editor. Instead, perform the following, additional steps:
译:要将事件查看器连接到独立播放器,请按照查看 Addressables 事件下的步骤进行操作,但最后一步不是在编辑器中进入 Play 模式。相反,执行以下其他步骤:
Open the Build Settings window (menu: File > Build Settings).译:打开生成设置窗口(菜单:File > Build Settings)。
Check the Development Build option.译:勾选开发构建选项。
Check the Autoconnect Profiler option.译:勾选自动连接 Profiler 选项。
Open the Unity Profiler __window (menu: __Window > Analysis > Profiler).译:打开 Unity Profiler 窗口(菜单:Window > Analysis > Profiler)
On the Build Settings window, click Build and Run.译:在生成设置窗口上,点击 Build and Run
The Event Viewer automatically connects to your standalone player and displays the Addressables events that occur.
译:事件查看器会自动连接到您的独立播放器,并显示发生的 Addressables 事件
See Profiler overview for more information about using the Unity Profiler.
译:有关使用 Unity Profiler 的更多信息,请参见 Profiler 概述。
Event Viewer window
To access the window in the Editor, select Window > Asset Management > Addressables > Event Viewer.译:要在编辑器中访问窗口,请选择菜单:Window > Asset Management > Addressables > Event Viewer

The window has three sections:
译:该窗口有三个部分:
Toolbar:
Clear Events button: clears all recorded frames, erasing everything in the window.译:清除事件按钮:清除所有记录的帧,擦除窗口中的所有内容。
Unhide All Hidden Events: returns any asset or operation lifelines that you have hidden to their normal, displayed state. Only shown when you have hidden events.译:取消隐藏所有隐藏事件:返回您隐藏的任何资产或操作寿命线到其正常显示状态。仅当您隐藏事件时才会显示
Frame counter: displays the position of the frame cursor and the number of recorded frames. (If the toolbar doesn't display the Frame counter, the frame cursor is at the current frame.)译:帧计数器:显示帧光标的位置和记录的帧数。(如果工具栏不显示帧计数器,则帧光标位于当前帧。)
Frame step (<>) buttons: steps the frame cursor through recorded frames. (You can also use the keyboard arrow keys.)译:帧步骤(<>)按钮:通过记录的帧逐步移动帧光标。(您也可以使用键盘箭头键。)
Current button: moves the frame cursor to the current frame.译:当前按钮:将帧光标移动到当前帧。
Assets display: shows profiler and lifespan charts related to Addressables operations and assets.译:资产显示:显示与 Addressables 操作和资产相关的分析器和寿命图表。
FPS chart: the application frame rate.译:FPS 图表:应用程序帧率。
MonoHeap chart: the amount of managed memory in use.译:MonoHeap 图表:正在使用的托管内存量。
Event Counts: the number of Addressables events that occurred in a frame (view the events in the Event list).译:事件计数:在帧中发生的 Addressables 事件数量(在事件列表中查看事件)。
Instantiation Counts: the number of calls to Addressables.InstantiateAsync in a frame.译:实例化计数:在帧中对 Addressables.InstantiateAsync 的调用次数
Operation and asset lifespan charts: show when the system loads and releases operations or assets and display the reference counts. See Asset lifespan chart.译:操作和资产寿命图表:显示系统何时加载和释放操作或资产,并显示引用计数。请参
Event list: shows the Addressable operation events that occurred in the frame.译:
You can click in the chart area of the window to pause your application and set the position of the frame cursor. The frame cursor appears in the window as a vertical line and shows summary information for the selected frame.
译:您可以单击窗口的图表区域以暂停应用程序并设置帧光标的位置。帧光标会显示为垂直线,并显示所选帧的摘要信息
NOTE
The FPS and MonoHeap charts include all factors that affect performance, not just those related to Addressable assets.
译:FPS和MonoHeap图表包括影响性能的所有因素,而不仅仅是与Addressable资产有关的因素
Asset lifespan chart
The asset lifespan chart shows when an asset or operation is created, its current reference count, and when it is destroyed.
译:资产生命周期图表显示资产或操作何时创建、其当前引用计数以及何时销毁
To expand the display line showing the lifespan of an asset or operation, click the + button for the entry in the Assets list.
译:要展开显示资产或操作寿命线的显示行,请单击资产列表中条目的“+”按钮
To view the sub-operations or subassets of an entry, click the expand icon (>) of the parent object.
译:要查看条目的子操作或子资产,请单击父对象的扩展图标(>)
You can remove the lifeline of an asset or operation from the chart by right-clicking it and choosing Hide Selected Events on the context menu. Click the Unhide All Hidden Events button on the toolbar to reveal the lifelines of any hidden events.
译:您可以右键单击资产或操作的生命周期线,并在上下文菜单中选择“Hide Selected Events”来从图表中删除它。单击工具栏上的“Unhide All Hidden Events”按钮以显示任何隐藏事件的生命周期线

A lifespan chart shows the following information:译:生命周期图表显示以下信息:

Before the asset was loaded (no display).译:资产加载前(未显示)

The asset load is in progress (dull blue).译:资产正在加载(暗蓝色)

The asset is loaded (blue). The green bar shows the current reference count of the asset.译:资产已加载(蓝色)。绿色条表示资产的当前引用计数

The Event Viewer frame cursor, which shows information for the selected frame, in this case, the cursor indicates that the reference count of this asset is 4 during the selected frame.
译:事件查看器帧光标显示所选帧的信息。在这种情况下,游标指示该资产在所选帧期间的引用计数为4

After the asset is destroyed and unloaded (no display).
译:资产被销毁和卸载后(未显示)

The events associated with specific frames (events are only shown at the position of the frame cursor).
译:与特定帧相关联的事件(仅在帧光标位置显示)