Cleaner
While working with a project, you create, copy, move, inherit, rename, and delete assets. As a result, an enormous amount of unnecessary files can be created.在处理项目时,您可以创建、复制、移动、继承、重命名和删除资源。因此,会创建大量不必要的文件。
Cleaner is a tool used to optimize your project and save disk space by deleting assets that won’t later be used in the final build. Cleaner also checks for corrupted references to assets.Cleaner是一个用于优化项目并通过删除在最终构建中以后不会使用的资源来节省磁盘空间的工具。Cleaner还检查对资源的损坏引用。
- Cleaner checks only the file types that are considered assets in terms of UNIGINE. For custom file types to be checked, add the extensions in the Editor project settings.Cleaner只检查在UNIGINE中被认为是资源的文件类型。要检查的自定义文件类型,在Editor项目设置中添加扩展名。
- To learn how to use the tool, watch this video tutorial.要学习如何使用该工具,请观看这个视频教程。
Cleaner checks each asset that your project contains and displays irregularly used assets divided in three parts:Cleaner检查项目包含的每个资源,并显示错误使用的资源,分为三个部分:
-
Unused Assets — assets that are not used in any of the files included in your project (worlds, layers, nodes, meshes, materials) and not referenced from code in any of your source files stored in your project source/ folder, but still exist in the project.Unused Assets - 项目中存在的资源,但未在项目中包含的任何文件(世界、图层、节点、网格体、材质)中使用,并且未从项目的source/文件夹中引用代码引用 任何源文件。
Cleaner shows the file name and asset type for unused assets. As you click an unused asset in Cleaner, it is displayed in the Asset Browser and the Parameters window.
You can delete any or all of the displayed assets by using the Cleaner functionality.Cleaner显示了未使用资源的文件名和资源类型。当您在Cleaner中单击未使用的资源时,它将显示在资源浏览器和Parameters窗口中。
您可以使用Cleaner功能删除任何或所有显示的资源。The Unused Assets list also includes all assets that were referenced from the unused assets.Unused Assets列表还包括从未使用的资源中引用的所有资源。
-
Lost Assets — the assets referenced to by GUID but are not available in the project.Lost Assets 由GUID引用但在项目中不可用的资源。
As you click a lost asset, the asset containing a reference to it, is displayed in the Asset Browser and the Parameters window. Fixing of lost assets is possible only manually.当您单击丢失的资源时,包含对它的引用的资源将显示在资源浏览器和Parameters窗口中。只能手动修复丢失的资源。
The table in the Lost Assets section has three columns:Lost Assets节中的表有三列:
- Lost Asset — shows the GUID of the lost asset.Lost Asset 显示丢失资源的GUID。
- Asset File — shows the name of the file containing the reference to the lost asset.Asset File 显示包含对丢失资源的引用的文件的名称。
- Node Name — shows the name of the node, if the file containing the reference includes the node that actually has a reference to the lost asset.Node Name 显示节点的名称,如果包含引用的文件包含对丢失的资源有实际引用的节点。
-
Lost Runtimes — the runtime files generated for the assets that are not available in the project, but referenced by a node/nodes in the scene.Lost Runtimes 资源的生成运行时文件中没有这个项目,但引用的节点/节点在现场。
The table in the Lost Runtimes section has three columns:Lost Runtimes节中的表有三列:
- Runtime Path — shows the path to the lost runtime file.Runtime Path 显示丢失的运行时文件的路径。
- Asset — shows the name of the file containing the reference to the asset, for which the lost runtime file was generated.Asset 显示文件的名称包含参考资源,失去了运行时文件的生成。
- Node Name — shows the name of the node, if the file containing the reference includes the node that actually has a reference to the asset, for which the lost runtime file was generated.Node Name 显示节点的名称,如果包含引用的文件包含实际具有对资源的引用的节点,则为其生成丢失的运行时文件。
Information on time spent to complete the Cleaner processes can be printed to the console and the log file: you just need to set the UNIGINE_EDITOR_TIME_TRACE environment variable.信息的时间完成Cleaner流程可以打印到 控制台 和日志文件:您只需要设置UNIGINE_EDITOR_TIME_TRACE环境变量。
Using Cleaner使用 Cleaner#
To open the Cleaner window, choose Tools -> Cleaner on the Menu Bar of UnigineEditor.打开“Cleaner”窗口,在UnigineEditor的菜单栏中选择“Tools -> Cleaner”。
The Cleaner window will open:Cleaner窗口就会打开:
Recommended Workflow推荐的工作流程#
-
Click Refresh to check the project for lost and unused assets.单击Refresh检查项目中丢失的和未使用的资源。
You can narrow the search scope by specifying a directory in the Directory field: Cleaner will display and manage the lost and unused assets from the specified directory only. To see results after setting (or resetting ) the directory, click Refresh once again.您可以缩小搜索范围在Directory领域通过指定一个目录:Cleaner将显示和管理失去了和闲置资源从指定的目录。要查看设置(或重置)目录后的结果,请再次单击Refresh。
After analyzing assets in your project, Cleaner shows the following details.在分析了项目中的资源之后,Cleaner显示了以下详细信息。
-
Manage Unused Assets using the buttons available in the top part of the section:管理闲置资源使用可用的按钮的顶部部分:
- Delete Selected — deletes only the selected assets from the list of unused assets. This option is also available by right-clicking the selected files in Cleaner.Delete Selected 只从未使用的资源列表中删除选中的资源。通过右键单击Cleaner中的选定文件也可以使用该选项。
-
Delete Listed — deletes the whole list of currently displayed assets.Delete Listed 删除当前显示的资源的整个列表。
Use delete buttons carefully. Deleted assets cannot be restored.小心使用删除按钮。删除资源不能被恢复。 -
Show Ignore List... — displays the ignore list that already contains the default list of wildcards used to define the scope of check by Cleaner. This list can be extended by the user.Show Ignore List... 显示忽略列表已经包含默认通配符用于定义列表的范围由Cleaner检查。这个列表可以扩展的用户。
If a filename in your project is generated in code (for example, a string concatenated from several words), add such cases to the Ignore List. Otherwise, such files will be deleted.如果项目中的文件名是在代码中生成的(例如,由几个单词连接而成的字符串),请将此类情况添加到“忽略列表”中。否则,这些文件将被删除。Upon clicking the Check button, all project files left after applying the ignore list (i.e. the ones that are not ignored by Cleaner and, thus, will be checked) are displayed in the bottom part of the Ignore List window.在单击Check按钮,所有项目文件后应用忽略列表(即那些不是由Cleaner和忽视的,因此,将检查)显示在底部Ignore List窗口的一部分。
- Click Refresh to update the list. Deleting unused assets can reduce the number of lost assets.单击Refresh更新列表。删除不使用的资源可以减少资源丢失的数量。
- Fix Lost Assets. Fixing of lost assets is possible only manually — by checking each asset displayed in the second or third column.修复丢失的资源。修复丢失的资源是可能只有手动,通过检查每个资源显示在第二或第三列。
Manage Lost Runtimes using the buttons available in the top part of the section. The buttons are the same as for the Unused Assets:使用该部分顶部的按钮管理丢失的运行时。按钮与未使用资源相同:
- Delete Selected — deletes only the selected runtimes from the list of unused runtimes. This option is also available by right-clicking the selected files in Cleaner.Delete Selected 删除只有从列表中所选的运行时的未使用的运行时。这个选项也可以在Cleaner单击右键选中的文件。
Delete Listed — deletes the whole list of currently displayed runtimes.Delete Listed 删除当前显示的整个运行时列表。
Use delete buttons carefully. Deleted files cannot be restored.小心使用删除按钮。删除的文件不能被恢复。
Video Tutorial视频教程#
Watch the video below to learn how to delete unused assets with the Cleaner tool.观看下面的视频,学习如何使用Cleaner工具删除未使用的资源。