注意:如果要共享场景、示例、工具或其他资源,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 会将其识别为更新,因此您应该使用对您和您与之共享的所有人而言都明确的命名约定。
警告:不要从资源包中删除文件,然后添加具有相同名称的不同文件。Unity 使用唯一的 ID 来跟踪文件,因此它会将它们识别为不同并可能相互冲突的文件。在这些情况下,Unity 在导入它们时会显示警告符号。如果已删除文件然后决定替换它,请将其重命名(即使它与原始名称很接近)。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.