1.8 将custom package导入到你的项目中
1.8 Importing custom packages into your project
注意:Custom package一般翻译为“自定义包”,就是不是安装unity的时候自带的,是你从网站下载或是别的途径获得的。
Custom Unity packages are available from a variety of sources, and they can be very helpful when developing a project.
Unity的自定义包是从多种渠道获得的,在你开发一个项目的时候,它们会很有用。
Getting ready(准备工作)
As its title implies, this recipe requires a custom package to be imported. If you need one for testing purposes, please use the one inside the folder named 0423_01_09-11.
正如题目暗示的,这一部分内容需要一个可导入的自定义包。如果你需要一个包用以达到测试的目的,请在名为0423_01_09-11的文件夹中选取一个加以利用(这里面的这个文件夹应该是本书自带的电子资源,目前没有,不过不影响学习)。
How to do it...(如何去做)
To import a custom package, follow these steps:
导入自定义包,需要遵循以下步骤:
1.Inside the Unity editor, access the Assets menu.
1.在unity编辑器中,打开Assets菜单。
2.Enter the Import Package sub-menu and choose the Custom Package... option.
2.进入Import Package选项,选择Custom Package选项。
3.Browse to the package file you have saved on your disk and click Open.
3.找到你的自定义包在硬盘中的保存位置,点击打开。
4.Preview package contents in the top-right Preview window, if you like.
4.在右上方预览窗口中浏览包内的内容。
5.Make sure every needed component is selected and click Import.
5.确定每一个你需要的组建,点击导入。
6.Package contents should be ready and listed in the Project view.
6.这时候,包中的内容已经在项目面板(工程面板)中列好并显示了(如下图实例)。
Unity makes a copy of your file, converts it to an appropriate format (if necessary) and saves it into the Project browser's Assets folder.
Unity会为你的文件制作备份,并将它转化为适当的形式(如果有必要)保存到项目浏览器中的Assets文件夹内。
How it works...(工作原理)
Custom packages are commonly used to distribute a number of assets inside a single compressed file. As they are made by third parties, the content inside those packages may vary, as they can include scripts, 3D models, texture maps, materials and any other file handled by Unity. Once imported, the package content is uncompressed into your project's Assets folder, and can be accessed through the Project window.
Custom packages 一般用来将大量的资源分配进一个单一的压缩文件之中。这些包往往由第三方制作的,内涵很多种资源,比如3D模型、贴图、材质和其他unity可识别操作的文件。当你导入的时候,包里的内容就被解压到你项目里的资源文件夹下,并且你可以通过项目窗口获得、使用它们。
There's more...(更多)
Third-party made content can also be found, downloaded, and bought from the Unity Asset Store. For more information, access
http://unity3d.com/unity/asset-store/ 在unity官网的资源商场里,可以找到并下载第三方制作的自定义包,官网网址如上。