Upgrading Packages
更新包
Unity Standard Assets, Asset Store downloads and assets in Custom Packages are all imported into projects via packages. See Asset Packages for details, including how to import and export packages, as well as export updated packages.
Unity标准资源,资源商店下载资源和自定义包的资源都通过包导入项目.参考"资源包",包括怎样导入导出包,和导出更新包.
Often packages are updated by their makers; adding new files, removing files, or changing existing files. If you have already installed a package, you may want to upgrade your version to match a newer version.
通常包是由它们的制作者更新的:添加文件,删除文件,或者更改现有文件.如果你已经安装了一个包,你可能想要更新你的版本以匹配新版本.
When you import a package, Unity checks whether this is a newer version of an existingpackage, containing newer asset files (a re-install / upgrade) or a completely new package. If Unity detects the package is an upgrade, it gives you a Re-install option along with checkbox options of which asset files you want to re-install. These are detailed below in Re-install Situations.
当你导入一个包,Unity检测它是否是一个现有包的更新版本,包含更新资源文件(一个重新安装/更新)或一个完整的新包.如果Unity认定此包是一个更新,它会给你一个关于你要重新安装资源文件的重新安装选项以及复选框选项.以下是重新安装情况的详细说明:
Warning: Re-installing deletes files! Note that:
警告:重新安装删除文件!注意如下:
· The Re-install checkbox is pre-selected.
重新安装复选框是预选择的.
· Files to re-install are pre-selected.
文件重新安装是预选择的.
If you leave the selections as they are, and click on Import, Unity deletes the existing, pre-selected files and installs new ones.
如果你如此选择,并点击导入,Unity删除现有的,预先选择的文件并安装新的.
This functionality ensures projects importing updated packages, particularly those from theAsset Store and Standard Assets which can be regularly updated, don’t keep unused files in your project, such as duplicate files or old files that have been removed from the package. However, it also means that it is easy to accidentally delete assets that you want to keep.
这个功能确保项目导入更新包,特别是那些来自资源商店的资源和标准资源可以定期更新,不让没用的文件保留在你的项目中,诸如复制文件或已经从包中移除的旧文件.然而,这也意味着很容易意外删除你想保留的资源.
If you are not sure about which asset files you want to re-install, you are strongly advised to back up any asset files away from the project’s Asset folder, via your computer’s Finder (Mac) or File Finder (Windows) before re-installing/upgrading packages.
如果你不确定哪一个资源文件是你想重新安装的,强烈建议你在重新安装/升级包之前,通过计算机的文件查找功能备份项目资源文件夹内的所有资源.
Import Package dialog’s Re-install Package option
导入包对话框的重新安装包选项
Moving an Asset File or Package Folder
移动资源文件或包文件夹
If you move an element of a package (that is the package folder itself or a package’s asset file) around inside the package’s parent folder, Unity can locate the moved element and offer re-install options. However, any elements of a package which you move outside the asset package’s parent folder, Unity no longer recognises as part of a package and assumes a new install.
如果你从包的父文件夹内中移动一个元素(包文件夹本身或一个包的资源文件),Unity可以定位到移动元素并提供重新安装选项.然而,你移动包内任何文件到包的父文件夹外,Unity不再认为它是包的一部分,并假的是一个新安装.
Import and Re-install/Upgrade Options
导入和重新安装/更新选项
Below aresome example situations.
下面是假的情况例子.
Initial Import
初始导入
For a brand new package, never imported before, in the Import Package dialog box:
一个之前没被导入过的新包,在导入包对话框中:
· All folders are expanded and checked by default.
所以文件夹都被默认展开和检测
· Each asset (including folders) is marked as NEW.
每一个资源(包括文件夹)都被标记为"新的".
· There is no Re-install option.
这里没有重新安装选项
All new asset files
全新资源文件
Changed Asset File Update
更改资源文件更新
If a file has changed in the package, Unity displays the CHANGED icon against it. For example:
如果一个文件在包内被修改过,Unity给它标记"已改变"图标.例如:
MyExamplePackage1 has an update to its asset ExampleAssetA. All the other assets are exactly the same as in the previous version of MyExamplePackage1; there is no change to their files.
MyExamplePackge1 有一个它的资源 ExampleAssetA的更新.其他所以资源保持原先版本:它们的文件没有改变.
In the Import Package dialog box:
在"导入包"对话框:
ExampleAssetA is marked as CHANGED.
ExampleAssetA 被标记为"已改变"
· There is a Re-install option. This is selected by default.
这是一个重新安装选项.默认已经被勾选.
[1] With the Re-install option selected (default):
使用重新安装选项(默认):
· You can choose the unchanged asset files to update. (Selected to re-install is the default.)
你可以选择那些没有改变的资源文件去更新.(选择重新安装是默认的)
· You can choose the updated asset file to re-install. (Selected to re-install is the default.)
你可以选择更新一文件来重新安装.(选择重新安装是默认的)
Re-install Package selected
勾选"重新安装包"
[2] With the Re-install option UNselected:
不使用重新安装选项:
· You cannot choose the unchanged asset files to re-install. They are greyed out.
你不能选择那些没有改变的资源文件来重新安装.它们是灰色的.
· You can choose or unselect the updated asset file to re-install. (Selected to re-install is the default.)
你可以选择或不选择已更新资源文件来重新安装.(默认选择重新安装)
Re-install Package Unselected
没有选择"重新安装包"
New Asset File Update
新资源文件更新
If a file is new in the package, Unity displays the NEW icon against it. For example:
如果一个文件新加入包,Unity给它显示"新的"图标.例如:
MyExamplePackage1 has a new asset file; ExampleAssetB. All the other assets are exactly the same as in the previous version of MyExamplePackage1; there is no change to their files.
MyExamplePackage1 有一个新资源文件:ExampleAssetB.所以其他资源都保持原先版本:它们的文件没被更改.
In the Import Package dialog box:
在"导入包"对话框:
ExampleAssetB is marked as NEW.
ExampleAssetB 被标记为"新的".
· There is a Re-install option. This is selected by default. If you leave the Re-installoption selected, you have the option to re-install unchanged files, as described inChanged Asset File Update, above.
这是一个重新安装选项.默认被勾选.如果你按此选择,你将重新安装没被更改的文件,如同"已改变资源文件更新"所描述.
· The new file’s install is unaffected by the Re-install option.
新文件不受重新安装选项影响.
Deleted Asset File Update
删除资源文件更新
If a file has been deleted in the package, Unity displays the DELETED icon against it. For example:
如果一个文件已经在包内删除,Unity将给它显示"已删除"图标.例如:
MyExamplePackage1 has been updated; ExampleAssetA has been removed. All theother assets are exactly the same as in the previous version of MyExamplePackage1; there is no change to their files.
MyExampePackage1 已经更新:ExampleAssetA已被删除.所以其他资源保持原先版本:它们的文件没被更改.
In the Import Package dialog box:
在"导入包"对话框:
ExampleAssetA is marked as DELETED.
ExampleAssetA 被标记为"已删除".
· There is a Re-install option. This is selected by default. If you leave the Re-installoption selected, you have the choice to re-install unchanged files, as described inChanged Asset File Update, above.
这是一个重新安装选项.默认为已选择.如果你按此选择,你将尝试重新安装没被更改的文件,如"已改变资源文件更新"中所描述.
· Options:
选项:
· [A] To delete ExampleAssetA in your project, leave the Re-install option selected.
通过勾选重新安装选项,在你的项目里删除ExampleAssetA.
· [B] To keep ExampleAssetA in your project, DE-select the Re-install option.
不勾选重新安装选项,保持ExampleAssetA在你的项目里.
Replacement Files & Packages
替换文件&文件夹
Files
文件
Each package folder, sub-folder, and asset file in a package has a unique identifier (a GUID). If a package’s maker deletes an asset file in a version of their package, then, in a later version, replaces it with a file of the same name but uses an entirely new file as the replacement, the new file has a different GUID to the original. In this case, Unity detects that the there is different file with a name conflict and displays a warning. Here is an example:
每一个包文件夹,子文件夹和资源文件在包内都有一个唯一的标识符(GUID全局唯一标识符).如果一个包的制作者删除了他的包的一个版本的一个资源文件,则在下一个版本,用一个全新的同名文件作为替换,新文件会具有和原来文件不同的GUID.在这种情况下,Unity检测到这是一个不同文件的名称冲突并显示一个警告.这里是一个例子:
ExampleAssetD has been removed from the package and later replaced with a different file.
ExampleAssetD已经被移除出包,稍后用一个不同文件替换.
In the Import Package dialog box:
在"导入包"对话框:
ExampleAssetD is marked as CHANGED.
ExampleAssetD被标记为"已改变".
ExampleAssetD is also marked with a WARNING.
ExampleAssetD也被标记为一个警告.
This warning is important: the replacement file may break links between the package and your project.
此警告很重要:替换文件可能中断包和项目间的链接.
Packages
包
Each package folder, sub-folder, and asset file in a package has a unique identifier (a GUID). If you install a different package with the same name as an existing one, the new packagefolder has a different GUID to the original. In this case, Unity detects that the there is different package with a name conflict and displays a warning. Unity assumes that the contents of the new package is replacing the existing package and handles it as a re-install. Here is an example:
每一个包文件夹,子文件夹,和资源文件在包内都有一个唯一的标识符(GUID).如果你安装一个和现有包同名的包,新包文件夹会有和原包不同的GUID.在这种情况下,Unity检测到不同包的同名冲突并显现一条警告过.Unity假的新包的内容是用来替换现有包的,并像重新安装般处理它.这是一个例子:
ExamplePackage1 is a new import; is a completely different package to ExamplePackage1 already installed. It has files; NewFile1, NewFile2. The existing ExamplePackage1 had two existing files; ExistingFile1, ExistingFile2.
ExamplePackage1 是一个新导入:已经安装了一个完整不同的ExamplePackage1包.它有文件:NewFile1,NewFile2.现有ExamplePackage1有两个现有文件:ExistingFile1,ExistingFile2.
In the Import Package dialog box:
在"导入包"对话框:
ExamplePackage1 folder is marked as CHANGED.
ExamplePackage1 文件夹被标记为"已改变".
ExamplePackage1 folder is also marked with a WARNING.
ExamplePackage1 文件夹也被标记为"警告".
NewFile1 and NewFile2 files are marked as NEW.
NewFile1和NewFile2被标记为"新的".
ExistingFile1 and ExistingFile2 are marked as DELETED.
ExistingFile1和ExistingFile2被标记为"已删除".
Note on the warning: While, in this circumstance, the replacement folder may not break links in your project, take care to select the files you want for import and deletion.
注意警告:虽然,在这种情况下,替换文件夹可能不会中断项目中的链接,请小心选择要导入和删除的文件.