Asset Packages
资源包
Unity packages are a handy way of sharing and re-using Unity projects and collections of assets; Unity Standard Assets and items on the Unity Asset Store are supplied in packages, for example.
Unity包是共享和复用Unity项目和资源集的一种简便方法.例如,Unity标准资源和Unity资源商店上的项目都是以包的形式提供的.
Packages are collections of files and data from Unity projects, or elements of projects, which are compressed and stored in one file, similar to Zip files. Like Zip files, a package maintains its original directory structure when it is unpacked, as well as meta-data about assets (such as import settings and links to other assets).
包是Unity项目或项目元素的文件和数据的集合,它们被压缩并存储在一个文件中,类似于Zip文件.像zip文件一样,当它打开时包保持其原有的目录结构和关于资源的元数据(如导入设置和其他资源的链接).
In Unity, the menu option Export Package compresses and stores the collection, whileImport Package unpacks the collection into your currently open Unity project.
在Unity中,菜单选项"导出包"压缩和存储资源集,"导入包"解包资源集到你当前打开的项目中.
NOTE: Importing changed or upgraded packages gives you a Re-install Package option. Note that if you choose this option, Unity first deletes the existing assets associated with the package before installing a new version. If you think you may need the older version, back it up before re-installing by making a copy of the files.
For further information on re-installing, see Upgrading Packages.
注意:导入已更改或升级的包将给你一个重新安装包选项.
请注意,如果你选择此项,Unity在安装新版本前首先删除旧版本包相关的现有资源.如果你认为需要旧版本,在重新安装前备份它.
更多参考:升级包.
This page contains information on:
此页包含以下信息:
· Import Package: - Standard Asset Packages - Custom Packages导入包:标准资源包和自定义包
· Export Package导出包
· Exporting Updated Packages导出更新包
Import Package
导入包
You can import Standard Asset Packages, which are asset collections pre-made and supplied with Unity, and Custom Packages, which are made by people using Unity.
你可以导入标准资源包,它们是由Unity重新制作和提供的资源集,和人们用Unity制作的自定义包.
Choose Assets > Import Package > to import both types of package.
选择资源->导入包来导入这两种包.
Fig 1: Asset>Import Package menu
图1:资源>导入包按钮
Standard Asset Packages
标准资源包
Unity ‘Standard Assets’ consist of several different packages: 2D, Cameras, Characters, CrossPlatformInput, Effects, Environment, ParticleSystems, Prototyping, Utility, Vehicles.
Unity标准资源由多个不同包组成:2D,摄像机,人物,跨平台输入,效果,环境,粒子系统,原型,工具,交通工具.
To import a new Standard Asset package:
导入一个新标准资源包:
1. Open the project you want to import assets into.
打开你想导入资源的项目.
2. Choose Assets > Import Package > plus the name of the package you want to import, and the Import Unity Package dialog box displays, with all the items in the package pre-checked, ready to install. (See Fig 2: New install Import Unity Package Dialog Box.)
选择资源>导入资源包>加上你想要导入的包名,导入Unity包对话框即显示,预先检测包的所以项目,准备安装.
3. Select Import and Unity puts the contents of the package into a Standard Asset folder, which you can access from your Project View.
选择导入,Unity将把包的内容放入标准资源文件夹,你可以在你的项目视图上访问它.
Fig 2: New install Import Unity Package dialog box
图2:新安装导入Unity包对话框
NOTE: Updating Standard Asset Packages - When you update or re-install a different version of a Standard Asset package, Unity gives you a Re-install option. Check the box to re-install. (See Fig 3: Re-install check box.) If you select this option, Unity deletes the existing assets associated with this package before installing new ones.
注意:更新标准资源包-当你更新或重新安装一个不同版本的标准资源包时,Unity会给你一个重新安装选项.勾选复选框重新安装.(见图3:重新安装复选框)如果你选择此项,Unity安装新包之前先删除与此包相关的现有资源.
Fig 3: Re-install Package check box
图3:重新安装包复选框
See Upgrading Packages for more details on using this option.
更多参考:更新包.
Custom Packages
自定义包
You can import custom packages which have been exported from your own projects or from projects made by other Unity users.
你可以导入你从自己项目或别人项目制作的自定义包.
To import a new custom package:
导入一个新的自定义包:
1. Open the project you want to import assets into.
打开你要导入资源的项目.
2. Choose Assets > Import Package > Custom Package… to bring up up File Explorer (Windows) or Finder (Mac).
选择资源>导入包>自定义包...打开文件管理系统.
3. Select the package you want from Explorer or Finder, and the Import Unity Packagedialog box displays, with all the items in the package pre-checked, ready to install. (SeeFig 4: New install Import Unity Package dialog box.)
在文件管理系统选择你要导入的包,导入Unity包对话框就会显示,随着重新检测包的所以项目,准备安装.
4. Select Import and Unity puts the contents of the package intothe Assets folder, which you can access from your Project View.
选择导入,Unity将把包的内容放入资源文件夹,你将可在你的项目视图上访问它们.
Fig 4: New install Import Unity Package dialog box
图4:新安装导入Unity包对话框
NOTE: Updating Custom Packages - When you update or re-install a different version of aCustom Package, Unity gives you a Re-install option. Check the box to re-install. (See Fig 5: Re-install check box.) This option deletes the existing assets associated with this package before installing new ones.
注意:更新自定义包-当你更新或重新安装不同版本的自定义包时,Unity将给你一个重新安装选项.勾选复选框重新安装(见图5:重新安装复选框)这个选项将在安装新包前删除此包现有资源.
Fig 5: Re-install Package check box
图5:重新安装包复选框
See Upgrading Packages for more details on using this option.
更多参考:更新包.
Export Package
导出包
Use Export Package to create your own Custom Package.
使用导出包选项创建你的自定义包:
1. Open the project you want to export assets from.
打开你要导出资源的项目.
2. Choose Assets > Export Package… from the menu to bring up the Exporting Packagedialog box. (See Fig 6: Exporting Package dialog box.)
选择资源>导出包...从这种菜单调出导出包对话框.(见图6:导出包对话框)
3. In the dialog box, select the assets you want to include in the package by clicking on the boxes so they are checked.
在此对话框,勾选你要导出的资源的复选框使其包含在包内.
4. Leave the include dependencies box checked to auto-select any assets used by the ones you have selected.
选中"包含依赖"复选框将自动选择任何对你选择资源有用的其他资源.
5. Click on Export to bring up File Explorer (Windows) or Finder (Mac) and choose where you want to store your package file. Name and save the package anywhere you like.
点击"导出"调出文件管理系统,选择你要存放的包的位置.命名和保存包到任何你喜好的地方.
HINT: 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 all models, textures and other assets that appear in the scene will be exported as well. This can be a quick way of exporting a bunch of assets without manually locating them all.
提示:当导出包时,Unity能同时导出所以依赖项.所以,例如,如果你选择一个场景并导出所有依赖项,那么在场景中出现的所有模型,贴图和其他资源都将同时被导出.这是一个快速导出一堆资源的方法,无需手动查找它们.
Fig 6: Exporting Package dialog box
图6:导出资源对话框
Exporting Updated Packages
导出更新包
Sometimes you may want to change the contents of a package and create a newer, updated version of your asset package. To do this:
有时你可能想改变一个包的内容而创建一个新的,更新你的资源包版本.做法如下:
· Select the asset files you want in your package (select both the unchanged ones and the new ones).
选择你想放入包的资源文件(改变和没改变的都要选)
· Export the files as described above in Export Package, above.
导出文件如上"导出包"所述.
NOTE: You can re-name an updated package and Unity will recognise it as an update, so you can use incremental naming, for example: MyAssetPackageVer1, MyAssetPackageVer2.
注意:你可以重命名一个更新包并且Unity将会认可它作为一个更新,所以你可以用增量命名法,如:我的资源包2,我的资源包2(尽量不要用中文命名,Unity对中文支持不好).
HINT: It is not good practise to remove files from packages and then replace them with the same name: Unity will recognise them as different and possibly conflicting files and so display a warning symbol when they are imported. If you have removed a file and then decide to replace it, it is better to give it a different, but related name to the original. SeeUpgrading Packages: Replacement Files and Folders for more details on how this affects package importing.
提示:将文件从包中删除并用相同名称命名它们不是一个好注意:Unity将把它们识别为不同和可能有冲突的文件,因此当导入它们是会显示警告.如果你已经删除一个文件然后决定替换它,最好给它一个不同但跟原始文件相关的名字.更多参考:"更新包:替换文件和文件夹"