Unity3D基础教程1-2:资产工作流(Asset Workflow)

2014-08-05 21:55:43|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:虚拟现实, 游戏, Unity3D|来源:唯设编程网

Unity Manual > User Guide > Unity Basics > Asset Workflow

Unity 手册->用户指南->Unity 基础->资产工作流

Here we'll explain the steps to use a single asset with Unity. These steps are general and are meant only as an overview for basic actions. For the example, we'll talk about using a 3D mesh.

这里我们将按步骤讲解用Unity去使用一个简单的资产。这些步骤是常用的并意味着仅作为基础功能的概述。对于这个例子,我们将讨论使用一个3D网格。

Create Rough Asset 创建粗糙资产

Use any supported 3D modeling package to create a rough version of your asset. Our example will use Maya. Work with the asset until you are ready to save.

使用任何支持3D建模程序包来创建一个你的资产的粗糙版本。我们的示例将使用Maya。与资产一起工作直到你准备保存它。

Import 引入

When you save your asset initially, you should save it normally to the Assets folder in your Project folder. When you open the Unity project, the asset will be detected and imported into the project. When you look in the Project View, you'll see the asset located there, right where you saved it.

当最初保存你的资产时,通常你应该保存它到你的项目文件夹的资产文件夹里。当你打开Unity项目的时候,资产将被确认并引入到项目里。当你在项目视图(面板)里查看时,你将看到资产已经在那里,正是你保存的地方。

Import Settings 引入设置

If you select the asset in the Project View the import settings for this asset will appear in the Inspector. The options that are displayed will change based on the type of asset that is selected.

如果你在项目视图里选取资产,这个资产引入的设置将在检视器面板(属性)里显示。显示的选项将基于那个选择的资产类型修改。

Adding Asset to the Scene 添加资产到场景

Simply click and drag the mesh from the Project View to the Hierarchy or Scene View to add it to the Scene. When you drag a mesh to the scene, you are creating a GameObject that has a Mesh Renderer Component. If you are working with a texture or a sound file, you will have to add it to a GameObject that already exists in the Scene or Project.

从项目视图(面板)单点和拖动网格到层次(面板)或场景视图去添加它到场景。当你拖动一个网格到场景时,你正在建立一个拥有一个网格渲染的游戏对象。如果你正在使用一个纹理或一个声音文件工作,你必须增加它到一个场景或项目已经存在的游戏对象。

Putting Different Assets Together 组合不同的资产

Here is a brief description of the relationships between the most common assets

这里是最常见的资产间关系的简要说明。

*       A Texture is applied to a Material

*       纹理应用于一个材料

*       A Material is applied to a GameObject (with a Mesh Renderer Component)

*       材料应用于一个游戏对象(有一个网格渲染的组件)

*       An Animation is applied to a GameObject (with an Animation Component)

*       动画应用于一个游戏对象(有一个动画组件)

*       A sound file is applied to a GameObject (with an Audio Source Component)

*       声音文件应用于一个游戏对象(有一个音频源组件)

Creating a Prefab 创建预制品

Prefabs are a collection of GameObjects & Components that can be re-used in your scenes. Several identical objects can be created from a single Prefab, called instancing. Take trees for example. Creating a tree Prefab will allow you to instance several identical trees and place them in your scene. Because the trees are all linked to the Prefab, any changes that are made to the Prefab will automatically be applied to all tree instances. So if you want to change the mesh, material, or anything else, you just make the change once in the Prefab and all the other trees inherit the change. You can also make changes to an instance, and choose GameObject->Apply Changes to Prefab from the main menu. This can save you lots of time during setup and updating of assets.

预制品是一个可以在你的场景里重复使用的游戏对象或组件的集合。几个同样的对象可以从一个简单的预制品创建,称为实例。以树为例,创建一个树预制品允许你实例化几个同样的树以及在你的场景里放置它们。因为这些树是都连接到这个预制品,任何的改变传输至这个预制品,将自动地应用于所有树的实例。因此如何你想去修改网格、材料、或别的东西,你仅需要在预制品里做一次修改,而所有其它的树继承这个修改。你也可以对一个对象做出修改,然后从主菜单里选择GameObject->Apply Changes to Prefab游戏对象->将修改应用于预制品)。这可以在资产的配置和更新期间节省你许多的时间。

When you have a GameObject that contains multiple Components and a hierarchy of child GameObjects, you can make a Prefab of the top-level GameObject (or root), and re-use the entire collection of GameObjects.

当你有一个包含多个组件和一个子游戏对象的层次,你可以制作一个顶级的(或根的)游戏对象的预制品,然后重复使用整个游戏对象的集合。

Think of a Prefab as a blueprint for a structure of GameObjects. All the Prefab clones are identical to the blueprint. Therefore, if the blueprint is updated, so are all the clones. There are different ways you can update the Prefab itself by changing one of its clones and applying those changes to the blueprint. To read more about using and updating Prefabs, please view the Prefabs page.

考虑一个预制品作为一个游戏对象架构的蓝图。所有预制品克隆是同样的蓝图。因此,如何蓝图被更新,因而是所有的克隆。There are different ways you can update the Prefab itself by changing one of its clones and applying those changes to the blueprint.有不同的方法你可以改变一个更新的克隆和应用那些蓝图更改预制品本身。 To read more about using and updating Prefabs, please view the  page.要阅读更多有关使用和更新预制品,请查看预制品页。

To actually create a Prefab from a GameObject in your scene, first create a new Prefab in your Project View. Name the new Prefab whatever you like. Then, click on the Game Object in the scene that you want to make into a Prefab. Drag it to the new Prefab, and you should see the Game Object's name text turn blue. You have now created a re-usable prefab.

在你的场景里从一个游戏对象实际创建一个预制品,首先,在你的项目视图(面板)里创建一个新的预制品。命名这个新的预制品;然后,在场景里点击你想制作成预制品的游戏对象。拖动它到新的预制品,同时,你应当看到这个游戏对象的名称文本变蓝。你现在已经创建了一个重复使用的预制品。

Updating Assets 更新资产

You have imported, instantiated, and linked your asset to a Prefab. Now when you want to edit your source asset, just double-click it from the Project View. The appropriate application will launch, and you can make any changes you want. When you're done updating it, just Save it. Then, when you switch back to Unity, the update will be detected, and the asset will be re-imported. The asset's link to the Prefab will also be maintained. So the effect you will see is that your Prefab will update. That's all you have to know to update assets. Just open it and save!

你已经引入、实例化和连接你的资产到一个预制品。现在,当你想去编辑你的源资产,只需从项目视图(面板)里双击它。适当的应用程序将启动,以及你可以做你想的任意修改。当你完成更新它,只需保存它。然后,当你转回到Unity,更新将被发现,以及资产将被重新引入。资产连接到的预制品将保持不变。所以,这个效果你将看到,你的预制品将更新。这就是你必须知道更新资产,只需打开并保存。

发表评论0条 】
网友评论(共?条评论)..
Unity3D基础教程1-2:资产工作流(Asset Workflow)