1.7 Importing Unity packages into your project
前言:初学者可能会想,什么是Package,我在这里通俗的解释一下。根据前面几节的学习,你可以看到,unity是个典型的集成环境,里面有各类资源:模型(FBX格式文件等)、贴图(PSD格式等)、视频、声音甚至脚本,这些都是你的资源,而且类型复杂、什么格式都有,管理起来比较麻烦,比如你看你工程(或是项目)的硬盘位置,一堆文件。你可以在unity中将他们集体打包成unity专有的“.unitypackage”格式储存起来,用的时候再在unity中导入解包,就十分方便了。
The packages provided by Unity can save you a lot of development time. They usually contain resources (such as texture maps, materials, and so on) and fully implemented features ready to go into your project. When creating a new project, Unity offers to install those packages into the Assets folder. However, if you've missed it at first, you can still import them into your project at any time.
Unity提供的packages(包)可以为你节省大量的游戏开发时间。包里面,通常包含各类资源(比如纹理贴图、材质等等)以及各种已经实现的功能,你可以将这些包添加到你的工程(项目)当中去。当你创建一个新工程(项目)的时候,unity会提示您在你的资源文件夹(Assets Folder)中安装那些包。然而,如果你一开始的时候错过了这个提示,你依然可以在任何时候,再将他们导入到你的工程(项目)中。
How to do it...(如何去做)
To import a Unity package, follow these steps:
导入unity的Package(包),需要遵循这些步骤:
1.Inside the Unity editor, access the Assets menu.
1.在unity编辑器中,打开Assets菜单。
2.Enter the Import Package sub-menu and choose a package from the list.
2.进入Import Package(导入包),在列表中选择你要导入的包。
3.Make sure every needed component is selected and click Import.
3.在新弹出的列表中确认你需要导入的内容,选择并点击导入。
4.Package contents should be ready and listed in the Project view.
4.包内的内容应该已经展示在工程面板(项目面板)里面了(操作流程如下图)
How it works...(工作原理)
Unity installation files include a number of packages that can be imported into your project as ready-to-use resources. Inside those packages are all the assets needed to implement a specific feature or functionality. Once imported, new features can be accessed through the Project view (and dragged and dropped into your level) or through newly added menu items(the Tree Creator package, for instance, adds the Tree option into the Create Other sub-menu of the GameObject menu).
在unity的安装文件中,囊括了大量的Package,这些Package可以作为预用资源导入到你的工程(项目)中。在那些包里,都是要实现一些功能的资源。当你导入后,通过项目面板就可以获得一些新的功能了(可以将这些新功能、新资源拖拽、下拉到你的项目文件层级下),或者是通过更新后的菜单选项中获取(比如说,Tree Creator Package,树木创建包,就将Tree这个选项加入到GameObject | create Other子目录下了)。
There's more...(更多)
Importing Unity packages can also be done through the Project Wizard. When starting a new project, check the boxes of the packages you want to import.
也可以通过项目导航(工程导航)来导入unity的包,当你开始一个新项目的时候,请确认工程导航盒里你要导入的包。