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?seethis?page
使用支持的3D建模軟件創建你的基礎資源,我們將使用Maya,直到你做好基礎資源并且保存。這個列表
中的軟件都是被unity支持的。
Import(導入)
When?you?save?your?asset?initially,?you?should?save?it?normally?to?theAssetsfolder?in?your?Project?folder.
When?you?open?the?Unity?project,?the?asset?will?be?detected?and?imported?into?the?project.?When?you?look
in?theProject?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?seethis?page
首先,當你保存了你做好的資源(模型),你需要把它保存在項目文件夾下的assest文件夾里。這樣當你
啟動unity項目時這個資源將被檢測到并且導入到項目中。在unity的項目窗口中可以看到它。請注意,unity
使用的FBX格式由你所使用的建模軟件轉換格式。你需要有你使用的建模軟件的FBX導出器來為unity使
用,或者你可以從你的建模軟件里直接導出FBX格式存到項目文件夾。這個列表中的軟件都是被unity支持的。
Import?Settings(導入設置)
If?you?select?the?asset?in?theProject?Viewthe?import?settings?for?this?asset?will?appear?in?theInspector
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?theHierarchyorScene?Viewto?add?it?to?the
Scene.?When?you?drag?a?mesh?to?the?scene,?you?are?creating?aGameObjectthat?has?aMesh?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.
通過拖拽你的資源從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?aMaterial貼圖應用于材質
?A?Material?is?applied?to?a?GameObject?(with?a?Mesh?Renderer?Component)材質應用于游戲對象(在
meshrenderer組件中)?AnAnimationis?applied?to?a?GameObject?(with?an?Animation?Component)
動畫應用于游戲對象(在animation組件中)A?sound?file?is?applied?to?a?GameObject?(with?anAudio?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?chooseGameObject->Apply?Changes?to?Prefabfrom?the?main?menu.?This?can?save?you
lots?of?time?during?setup?and?updating?of?assets.Prefabs
是一批可以在場景中重復使用的游戲對象或組件。多個完全相同的物體可以創建一個prefab預制,
實例調用。以樹為例。創建一個樹的預制允許你在場景中放置多個完全相同的樹。因為所有的樹都是實例
關聯,當你改動預制的任何參數時,它們會自動的應用到所有樹上。所以,如查你想改動網格、材質或別
的東西,你只需要在預制中改動一次,所有的樹將會隨著改變。你也可以改變所有樹中的其中一個實例,
然后在菜單中選擇
GameObject(游戲對象)
->Apply?Changes?to?Prefab(應用改變到預制)
,這可以
幫你節省大量的時間在重復設置和更新資源上。