注意:如果要共享场景、示例、工具或其他资源,Unity 建议创建您自己的资源包。但是,也可以使用资源包 (.unitypackage
) 格式。例如,您可能想要创建一个资源包,将多个资源或整个场景从一个项目复制到另一个项目。
按本节中的说明,从 Unity 编辑器的 Assets 菜单中导出资源包。
注意:如果您的资源质量很高,并且您相信其他用户会认为它们很有用,请按照 发布到 Asset Store 文档中的说明创建资源包草案并将其上传到 Asset Store
要创建您自己的自定义资源包,请执行以下操作:
打开要从中导出资源的项目。
从菜单中选择 Assets > Export Package 以打开 Exporting package 对话框。
在此对话框中,通过单击复选框来选择要包含在资源包中的资源。
将 Include dependencies 保持启用状态,即可自动选择已选资源使用的所有资源。
单击 Export 以打开文件资源管理器,然后选择要存储资源包文件的位置。
为资源包命名,并将其保存任何所需位置。
Tip: When exporting a package, Unity can export all dependencies as well. So, for example, if you select a Scene and export a package with all dependencies, then Unity exports all Models, Textures and other assets that appear in the Scene as well. This can be a quick way of exporting several assets without manually locating them all.
Note: If you select Include dependencies, and your current selection contains or references any scripts, Unity includes all scripts in your project. This is because Unity does not have a way to determine whether the scripts in your selection reference other scripts. For example, if you select a Scene asset in your project to export, and that scene contains a GameObject with a script attached, then Unity counts all scripts in your project as dependencies. If you do not want Unity to do this, you should uncheck Include dependencies.
如果要更改资源包的内容并创建资源包的更新版本,请在资源包中选择所需的资源文件(未更改的资源文件和新的资源文件)。然后,按照上述说明导出文件。
请使用增量式名称来重命名更新的资源包:例如,MyAssetPackageVer1
、MyAssetPackageVer2
。Unity 会将其识别为更新,因此您应该使用对您和您与之共享的所有人而言都明确的命名约定。
Warning: Don’t remove files from asset packages and then add different files with the same name. Unity uses unique IDs to track files, so it recognizes them as different and possibly conflicting files. In these cases, Unity displays a warning symbol when importing them. If you have removed a file and then decide to replace it, rename it something else, even if it is close to the original name.