管理资源包
Package is a collection of files and data for UNIGINE projects stored in a single *.upackage file. A Package compresses data while preserving the original directory structure. Packages can be used to conveniently transfer files between your projects or exchange data with other users, be it content (a single model or a scene with a set of objects driven by logic implemented via C# components) or files (plugins, libraries, execution files, etc.).资源包(Package)是存储在单个*.upackage文件中的UNIGINE项目的文件和数据的集合。资源包压缩数据,同时保留原来的目录结构。资源包可以用来方便地在项目之间传输文件或与其他用户交换数据,无论是内容(单个模型或一组对象,这些对象由通过 c#组件实现的逻辑驱动)还是文件(插件、库、执行文件等)。
Creating a Package创建资源包#
UnigineEditor allows exporting into a Package file both assets from the Asset Browser and external files (i.e. files stored outside the data_path directory).UnigineEditor允许从Asset Browser和外部文件(即存储在data_path目录之外的文件)导出资源到一个资源包文件。
In general, the pipeline is similar for both cases, however, there are some differences.一般来说,这两种情况下的管道是相似的,但是存在一些差异。
Exporting Assets From Asset Browser从资源浏览器导出资源#
To export assets from the Asset Browser into a Package file:将资源从Asset Browser导出到资源包文件中:
-
In the Menu bar, choose Packages -> Export Package and then click the Add Assets From Asset Browser button in the Export Package window that opens.在菜单栏中,选择Packages -> Export Package,然后在打开的Export Package窗口中单击Add Assets From Asset Browser按钮。
-
Select the assets that you want to add to the Package in the Select Assets window and click OK. You can even select the folder containing the whole project, and then deselect the data you don't require on the next step.在Select Assets窗口中选择您想要添加到Package中的资源,然后单击OK。您甚至可以选择包含整个项目的文件夹,然后在下一步中取消选择不需要的数据。
Note that you can do the same in the Asset Browser: right-click the required asset(s) or folder(s) and choose Export As Package option in the context menu.注意,您可以在Asset Browser中执行相同的操作:右键单击所需的资源或文件夹,并在上下文菜单中选择Export As Package选项。
-
Now you can select assets to be exported in the Export Package window using a checkbox for each asset.现在您可以在Export Package窗口中使用每个资源的复选框来选择要导出的资源。
Keep in mind that any single file that you want to include must be less than 2 GB. The Package size is not limited.请记住,您想要包含的任何单个文件都必须小于2 GB。资源包装尺寸不受限制。 -
You can automatically add all dependent assets to the package (a texture used by a material, materials assigned to an object, etc.) via the Include Dependencies checkbox (dependent assets are marked green in the list).你可以通过Include Dependencies复选框自动将所有依赖资源添加到资源包中(材质使用的纹理,分配给对象的材料等)(依赖资源在列表中被标记为绿色)。
-
After selecting assets click Export Package to pack them into a new *.upackage file.选择资源后,单击Export Package将它们打包到一个新的*.upackage文件中。
At least one asset must be selected to activate the Export Package button.必须选择至少一个资源来激活Export Package按钮。 - In the dialog window that opens, define the name and path to your package and click Save. 在打开的对话框窗口中,定义资源包的名称和路径,然后单击Save。
As soon as your Asset Package is successfully created, the location of your *.upackage file will be shown in your file manager.成功创建资源包后,*.upackage 文件的位置将显示在文件管理器中。
Exporting External Files出口外部文件#
To copy external files (i.e. project files stored outside the data_path directory) to a Package file:将外部文件(即存储在data_path目录之外的项目文件)复制到资源包文件:
- Open the Export Package window: in the Menu bar, choose Packages -> Export Package. If you have already added assets from the Asset Browser, you may skip this step as the window is open.打开Export Package窗口:在菜单栏中,选择Packages -> Export Package。如果您已经添加了从Asset Browser资源,你可以跳过这一步,窗户是开着的。
-
Сlick the Add External Files button, choose files or folders in the dialog window that opens and click Open. Note that the external folders are colored red, while the folders from the Asset Browser are blue.Сlick Add External Files按钮,在打开的对话框窗口中选择文件或文件夹,然后单击Open。注意,外部文件夹是红色的,而来自Asset Browser的文件夹是蓝色的。
You can't add files stored outside the project folder.你不能添加文件存储在项目文件夹。 - Select files and/or folders to be exported, click Export Package, specify the name and path to a new *.upackage file and click Save.选择要导出的文件和/或文件夹,单击Export Package,指定新*.upackage文件的名称和路径,然后单击Save。
Importing a Package导入资源包#
To import contents of an existing package to your project you need to:导入现有的资源包的内容到你的项目,你需要:
-
Drag it from the File Explorer directly into the Asset Browser or choose Packages -> Import Package in the Menu bar and select the *.upackage file. You can also right-click in the Asset Browser, choose Import New Asset in the context menu and select the package.直接从文件资源管理器将它拖到Asset Browser或选择Packages -> Import Package在菜单栏,选择*.upackage文件。Asset Browser还可以右击,选择Import New Asset上下文菜单并选择资源包。
If you have already added the *.upackage file to your targed project, double-click on it.如果您已经将*.upackage文件添加到目标项目中,请双击它。
Do not use a file manager of your OS to copy a package to your project's folder, as in this case the package will be displayed in the Asset Browser, but its contents won't be extracted.不要使用操作系统的文件管理器将资源包复制到项目的文件夹中,因为在这种情况下,资源包将显示在Asset Browser中,但其内容不会被提取。The following window will open:以下窗口将被打开:
Check the assets that are going to be imported. Assets in the package can be colored white, red, and yellow:检查将要导入的资源。资源包中的资源可以被涂成白色、红色和黄色:
- White-colored assets can be imported without any changes.是可以导入资源没有任何变化。
- Yellow-colored assets are imported with a postfix to resolve the name collision.导入带有后缀的黄色资源以解决名称冲突。
-
Red-colored assets cannot be imported due to one of the following reasons:红色的资源不能进口由于以下原因之一:
- The same asset is found in the project.在项目中可以找到相同的资源。
- Asset with the same Source Runtime GUID is found in the project.资源来源相同的项目中运行时发现GUID。
- Asset with the same Runtime GUID is found in the project.在项目中找到具有相同运行时GUID的资源。
- The specified target mount point is read-only.指定的目标挂载点是只读的。
To import all dependent assets for the ones that are selected, check Force Import Dependencies. Such assets will be colored green. For example, if you uncheck a texture used by a selected material, the texture will be imported anyway.要为选中的资源导入所有依赖的资源,请选中Force Import Dependencies。这些资源将被标记为绿色。例如,如果您取消选中所选材质使用的纹理,该纹理无论如何都会被导入。- After selecting all assets required for import, click the Import Package button.在选择进口所需的所有资源,单击Import Package按钮。
- Wait for the extraction process. Extraction time depends on the size of the assets selected for the import.
等待提取过程。提取时间取决于为导入选择的资源的大小
Except assets, you can also import files stored in a package. If such file already exists in the project, it will be colored red with no import option.除了资源,您还可以导入存储在资源包中的文件。如果这样的文件已经存在于项目中,它将被标记为红色,没有导入选项。
Upon successful package import, a new folder with the corresponding contents will be available in the Asset Browser and the following message will be displayed:成功导入资源包,一个新的文件夹中相应的内容将提供Asset Browser和将显示以下信息:
Managing a Package管理资源包#
Packages provided on Add-On Store may be updated by the package creator from time to time. In this case, you'll need to delete the previously added files and add the new package version. The Add-On Store Package History window shows all added packages downloaded from Add-On Store and helps deleting the package files in one click.插件商店(Add-On Store)中提供的资源包可能会由资源包创建者不时更新。在这种情况下,您需要删除以前添加的文件并添加新的资源包版本。Add-On Store Package History窗口显示所有添加包下载插件,帮助删除资源包的文件存储在一个点击。
To open the Add-On Store Package History window, select Packages -> Add-On Store Package History in the menu.要打开Add-On Store Package History窗口,请在菜单中选择Packages -> Add-On Store Package History。
The following window will open:以下窗口将被打开:
This window provides the following details and options:此窗口提供以下详细信息和选项:
Imported Packages | The list of packages from Add-On Store that have been imported to this project.已导入到此项目的Add-On Store中的资源包列表。 |
---|---|
File Hierarchy |
The hierarchy of files available in the selected package. If some package files have not been imported, they still be displayed in the File Hierarchy list but in grey color, as they are unavailable.所选资源包中可用文件的层次结构。如果一些包文件没有被导入,它们仍然会显示在File Hierarchy列表中,但是会以灰色显示,因为它们是不可用的。 The following options are available on this tab:在此选项卡下面的选项可用:
|
Description |
Displays the description of the package as provided by the package creator on Add-On Store including the package version.显示的描述提供的资源包作为资源包创造者等附加存储资源包版本。 |