Unity3D 官方基础教程 Asset Workflow

来源:互联网 发布:5g网络标准华为占多少 编辑:程序博客网 时间:2024/05/15 02:26

Asset Workflow(资源工作流程)

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的单一资源的使用步骤,这些步骤是通的且仅作为基本动作的概述,在本例中,我们将讨论如何使用一个三维网络。

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. For a list of applications that are supported by Unity, please see this page.
使用任何Unity 所支持的3D建模软件来创建一个粗制版资源,我们的例子将使用Maya.使用资源工作,直到你准备好保存。要查看Unity所支持的应用程序列表,请看本页

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. Please note that Unity uses the FBX exporter provided by your modeling package to convert your models to the FBX file format. You will need to have the FBX exporter of your modeling package available for Unity to use. Alternatively, you can directly export as FBX from your application and save in the Projects folder. For a list of applications that are supported by Unity, please see this page.
当你最初保存你的资源时,你应该将它保存到项目文件的Assets文件夹中,当你打开Unity的项目。资源将被检测导入项目中,查看项目视图,你会看到保存的资源已经在那里了。请注意Unity使用FBX输出模型组件把你的模型转换为FBX文件格式。你需要有Unity可使用的FBX输出模型组件,或者,你可以从应用程序直接导出为FBX并保存在项止文件中,要查看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.
Prefabs就是一个游戏对象及其组件的集合,它可以在你的场景中重复使用。几个相同的对象可以通过一个单一的预设件来创建,被叫做实例化。拿树来举例,创建一个树的预设件,你就可以实例化几个相同的树木将它们放置到你的场景里,由于这些树都是和预设件联系在一起的,在预设件上所做的任何更改将自动应用于所有的树。所以,如果你想改变网格、材质、或者别的什么,你只要在预设件中改变一次,所有树将继承这些变动。你也可以改变一个实例,通过主菜单选择GameObject->Apply Changes toPrefab应用更改到预设件。这可以在你设置和更新资源时节省大量的时间

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.
一个预置就是一个游戏对象的结构蓝图,所有的预置克隆体都和蓝图相同,因此,如果蓝图更新,所有克隆体也都更新。通过不同的方法可以更改预置本身,改变一个克隆体并且将这些改变应用于蓝图。要阅读更多关于预置的使用和更新问题,请查看Prefabs页面

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,资源的更新将被检测到并重新导入,资源到预置的链接也将维持不变,你将看到你的预置会更新。这些就是你必须知道的更新资源的内容,只需打开和保存它。要

Optional - Adding Labels to the Assets.(可选——给资源添加标签)

Is always a good idea to add labels to your assets if you want to keep organized all your assets, with this you can search for the labels associated to each asset in the search field in the project view or in the object selector.
如果你想让你的资源组织有序,为你的资源添加标签是个好主意。利用这个方法,你可以搜索到在项目视图中或对象选择器中与搜索字段相关的每个资源的标签。

Steps for adding a label to an asset:
给资源添加标签的步骤:

  • Select the asset you want to add the label to (From the project view).选择你想添加标签的资源(在项目视图中)

  • In the inspector click on the "Add Label" icon () if you dont have any Labels associated to that asset.
    在检视面板中点击"添加标签"图标,如果你还没有与资源相关的标签

    • If you have a label associated to an asset then just click where the labels are.
      如果你已经有与资源相关的标签,则只需点击一下那里的标签A

  • Start writing your labels.
    开始写你的标签

Notes:

  • You can have more than one label for any asset.
    你可以让任何资源拥有多个标签
  • To separate/create labels, just press space or enter when writing asset label names.
    要分割/创建标签,只需在输入标签名称时按空格或回车
原创粉丝点击