unity3d导入资源工作流程[编译]
来源:第三维度
编译:Alcohol1982
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 中使用一个 asset 的步骤。这些步骤是一个基本行为的常规、必须步骤。例如:我们将说说使用 3D mesh。
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.
使用支持的 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.
首先,当你保存了你做好的资源(模型),你需要把它保存在项目文件夹下的 assest 文件夹里。这样当你启动 Unity 项目时这个资源将被检测到并且导入到项目中。在 Unity 的项目窗口中可以看到它。请注意,Unity使用的 FBX 格式由你所使用的建模软件转换格式。你需要有你使用的建模软件的 FBX 导出器来为 Unity 使用,或者你可以从你的建模软件里直接导出 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.
如果你在 Project 面板中选择了你的资源,导入设置将在 inspector 面板中显示出来。显示出来的选项由选择的资源类型而定。
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 RendererComponent. 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.
通过拖拽你的资源从 project 窗口到 hierarchy 窗口或 scene 视窗就可以把资源添加进场景。当你拖拽资源到场景,就建立了一个 gameobject(游戏对象),它包括一个 mesh renderer component(网格渲染组件),如果是对一个贴图或声音进行操作,你得把它们添加到一个 gameobject 上,gameobject 必须已经存在于场景或项目中。
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)
材质应用于游戏对象(在 meshrenderer 组件中)
● An Animation is applied to a GameObject (with an Animation Component)
动画应用于游戏对象(在 animation 组件中)
● A sound file is applied to a GameObject (with an Audio Source Component)
声音文件应用于游戏对象(在 audiosource 组件中)
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 是一批可以在场景中重复使用的游戏对象或组件。多个完全相同的物体可以创建一个 prefab 预制,实例调用。以树为例。创建一个树的预制允许你在场景中放置多个完全相同的树。因为所有的树都是实例关联,当你改动预制的任何参数时,它们会自动的应用到所有树上。所以,如查你想改动网格、材质或别的东西,你只需要在预制中改动一次,所有的树将会随着改变。你也可以改变所有树中的其中一个实例,然后在菜单中选择 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.
考虑一个预制作为一种结构的游戏对象蓝图。所有的预制克隆是完全相同的蓝图。因此,如果蓝图被更新,所有的克隆也会更新。有不同的方式你可以更新预制本身,通过改变它的一个克隆,应用那些变化到蓝图。
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.
事实上要在场景中建立一个游戏对象预制,首先建立一个新的 prefab 在项目窗口中,起成你想要的名字,然后选择你想建立预制的游戏对象拖动到 prfab 中,然后你可以看到游戏对象的名字变成蓝色,标志你成功建立一个合格的预制。
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.
如果你没有任何卷标关联在资源上是在 inspector 面板下方的预览窗口中点击 按钮,
● If you have a label associated to an asset then just click where the labels are.
如果你有卷标则点击卷标
● 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.
要分开卷标点空格键,要建立卷标点回车键