Placeholder Image

字幕列表 影片播放

  • The Hierarchy in Unity is a complete list of any object in your open scene.


  • Objects are listed from A to Z order,


  • but it is also possible to create hierarchies of objects

    除此之外也可以建立物件的內部結構 結構一樣會從A到Z排序

  • which are in turn listed in A to Z order.

    物件的內部結構就是把物件群組 最上層的物件稱為父物件

  • Hierarchies of objects mean that they are grouped, with the top most object being called the Parent Object


  • and the rest being referred to as Children or Child objects.


  • These objects then have their transform values based upon that of their parent object.

    舉例來說, 當一個物件不屬於任何群組時 它的座標是取決於它和世界原點之間的距離

  • For example the position of an object when loose in the hierarchy

    但當它成為群組的一員時 它的座標則是取決於父物件的座標

  • is based on it's distance from the world origin, or zero point.

    在這個範例裡, 角色物件的座標在場景的原點 即是座標位置(0, 0, 0)

  • But when this object is made a child of another object it's position is relative to that of it's parent.

    同時另外一個方體物件在座標 (5, 1, 5)

  • In this example the character object is at the origin of the 3D scene,

    但當角色物件成為方體物件的子物件時 它的原點會變成父物件的座標

  • the position (0, 0, 0).

    現在角色座標變成 (-5, -1, -5)

  • And there is a cube object at position (5, 1, 5).

    這是它和方體物件(父物件)間的距離 所以這就成為它的座標

  • But when the character object is made a child of the cube - it's origin, or zero point,

    而當啟用支點旋轉時,旋轉的軸心會以 父物件為主,而非自己的支點

  • is then the position of the parent object, the cube.


  • Now the character's position is said to be (-5, -1, -5).


  • This being the distance from the cube object, it's parent and therefore it's origin position.


  • We can also see that with Pivot Point Rotation enabled

    建立鈕的功能如同主功能表上的Create Other

  • the rotation is now based on the parent object


  • rather than rotating around it's own axis.

    階層的搜尋與場景的搜尋功能相仿 讓你裡用物件名稱來搜尋物件

  • The same then applies to movement,

    場景視圖會將搜尋結果以外的物件變灰 讓你容易看見搜尋的物件

  • and scaling.


  • And this will apply until that object is no longer a child.


  • Other features of the hierarchy are the Create button

    舉例來說 如果我要搜尋擁有光源元件的物件(T:Light)

  • and Search field.

    因為場景內只有一個光源元件 所以階層內所顯示的只有光源元件相關的槍

  • The create button on the hierarchy acts as a mirror of the Game Object - Create Other top menu

    但如果我搜尋音效相關的元件(T:Audio Source) 階層內顯示出三個物件

  • and this will allow you to create various different things that you will need to construct your games in Unity.

    搜尋結果這三個物件 是都擁有音效元件的物件

  • Whilst the search field works in a similar way to the search field in the Scene view,

    當使用修飾碼搜尋時 階層的下方會顯示結果物件的路徑位置

  • allowing you to narrow down objects using their name.

    傷害音效是我目前所點選的物件 角色是它的父物件而方體是整個物件的父物件

  • The scene view then reacts by greying out other objects

    所以當取消搜尋後 你可以很容易看到該物件的位置

  • allowing you to see the object you've searched for more easily.


  • You can also make use of the modifier T: in order to search for types of object.

  • Type here being considered as one of the objects components.

  • For example if I search for T:Light

  • there is only one light in my current scene,

  • one on the end of the players gun.

  • And if I search for T: Audio Source

  • I'll be narrowed down to 3 objects,

  • the only ones in the scene that happen to have audio source components attached to them.

  • When searching in this way, the bottom of the hierarchy shows the path to the object that you've found.

  • Damage audio source being the one I have selected,

  • Player being it's parent and Cube being the parent of that object.

  • This means that when cancelling the search you can easily see where your object is.

  • It will also remain selected and the parent objects of that object will be expanded to show where it's located.

The Hierarchy in Unity is a complete list of any object in your open scene.



單字即點即查 點擊單字可以查詢單字解釋