За что отвечает вкладка hierarchy в unity

от admin

The Hierarchy window

The default Hierarchy window view when you open a new Unity project

The Hierarchy window displays every GameObject The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary in a Scene, such as models, Cameras, or Prefabs An asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info
See in Glossary . You can use the Hierarchy window to sort and group the GameObjects you use in a Scene. When you add or remove GameObjects in the Scene view, you also add or remove them from the Hierarchy window.

The Hierarchy window can also contain other Scenes, with each Scene A Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary containing their own GameObjects.

Parenting

Unity uses the concept of parent-child hierarchies, or parenting, to group GameObjects. An object can contain other GameObjects that inherit its properties.You can link GameObjects together to help move, scale, or transform a collection of GameObjects. When you move the top-level object, or parent GameObject, you also move all child GameObjects.

You can also create nested parent-child GameObjects. All nested objects are still descendants of the original parent GameObject, or root GameObject.

Child GameObjects inherit the movement and rotation of the parent GameObject. To learn more about this, see documentation on the Transform component A Transform component determines the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform. More info
See in Glossary .

 Child 1 and Child 2 are the child GameObjects of Parent. Child 3 is a child GameObject of Child 2, and a descendant GameObject of Parent.Child 1 and Child 2 are the child GameObjects of Parent. Child 3 is a child GameObject of Child 2, and a descendant GameObject of Parent.

Organize GameObjects

Create new GameObjects

To create a new GameObject in the Hierarchy window:

  1. Right-click on empty space in the selected Scene.
  2. Select the GameObject you want to create.

You can also press Ctrl+Shift+N (Windows) or Command+Shift+N (macOS) to create a new empty GameObject.

Note: New GameObjects are created in “rename” mode automatically. To disable this behavior, select the More (⋮) menu in the Hierarchy window and deselect Rename New Objects.

Toggle child GameObject visibility

To toggle the visibility of child GameObjects:

  1. Select the drop-down arrow (►) to the left of the parent GameObject.
  2. Press Alt while clicking the drop-down arrow (►) to toggle visibility of all descendant GameObjects of the root GameObject.
  3. Select the drop-down arrow again (▼) to collapse all descendant GameObjects.

Create child GameObjects

To create a child GameObject:

  • Drag the GameObject onto the parent GameObject in the Hierarchy.

Create parent GameObjects

You can add a new GameObject into the Hierarchy view as the parent of existing GameObjects.

To create a parent GameObject:

  1. Right-click a GameObject, or select multiple GameObjects on the same level and right-click.
  2. Select Create Empty Parent.

You can also press Ctrl+Shift+G (Windows) or Command+Shift+G (macOS) to create a parent GameObject.

Note: If you have set a default parent GameObject, Create Empty Parent creates the new GameObject as a child of the default parent, not as the parent of the selected GameObjects.

Create sibling GameObjects

A sibling GameObject is a GameObject with the same hierarchy as another child GameObject. To create a sibling GameObject:

  1. Drag the GameObject above or below an existing GameObject.
  2. Use the horizontal blue line to determine the order of the GameObject.

Duplicate GameObjects

To duplicate GameObjects, right-click the target GameObject and select Duplicate.

You can also press Ctrl+D (Windows) or Command+D (macOS) to duplicate the selected GameObject.

Paste GameObjects as child

You can cut or copy a selected GameObject and then paste it as a child of another GameObject. Pasted child GameObjects keep their world position.

To paste a GameObject as child:

  1. Right-click the selected GameObject, and then select Cut or Copy.
  2. Right-click the intended parent GameObject, and then select Paste as Child.

You can also press Ctrl+Shift+V (Windows) or Command+Shift+V (macOS) to paste a GameObject as a child.

Organize GameObjects with default parent

You can make any GameObject in the Hierarchy window a “default parent”. When you drag a GameObject into the Scene view, Unity automatically makes this GameObject the child of the GameObject you set as the default parent.

To make a GameObject a default parent:

  1. In the Hierarchy window, right-click on the GameObject.
  2. Select Set as Default Parent.

When you drag a GameObject into the Scene view, in the Hierarchy window, the child GameObject is indented below the default parent GameObject. The name of the default parent GameObject is bold.

In this image, the Cube GameObject is the default parent. When the user drags the Car GameObject into the Scene view, Unity automatically makes it the child of the Cube GameObject.In this image, the Cube GameObject is the default parent. When the user drags the Car GameObject into the Scene view, Unity automatically makes it the child of the Cube GameObject.

To remove default parent status from a GameObject:

  1. In the Hierarchy window, right-click on the GameObject.
  2. Select Clear Default Parent.

The name of the GameObject that was previously the default parent is no longer bold. When you drag a GameObject into the Scene view, it appears at the top level in the Hierarchy window. In other words, Unity does not make this GameObject the child of the GameObject that was previously the default parent.

In this image, no GameObjects in the Hierarchy window are set as the default parent. When the user drags the Car GameObject into the Scene view, Unity adds it at the top level of the hierarchy.In this image, no GameObjects in the Hierarchy window are set as the default parent. When the user drags the Car GameObject into the Scene view, Unity adds it at the top level of the hierarchy.

You can only set one default parent per Scene. In the Hierarchy window, if you set a GameObject as the default parent, and then you make a different GameObject in the same Scene the default parent, only the second GameObject is the default parent.

If you have multiple Scenes in the Hierarchy window, and you set default parents in each Scene, when you drag a GameObject into the Scene view, Unity makes the default parent GameObject in the active Scene the parent of the new GameObject.

In this image, the Cube GameObjects in both Scene1 and Scene2 are set as default parents. Unity sets the Cube in Scene1 as the parent of the Car GameObject, because Scene1 is the active Scene.In this image, the Cube GameObjects in both Scene1 and Scene2 are set as default parents. Unity sets the Cube in Scene1 as the parent of the Car GameObject, because Scene1 is the active Scene.

You can set a keyboard shortcut for the default parent setting in the Shortcuts manager. On the Shortcuts window, assign a keyboard shortcut to Hierarchy View > Set as Default Parent. If there is no default parent set, and in the Hierarchy window you select a GameObject, use the shortcut to make this GameObject the default parent. When a default parent is set, use the shortcut to remove default parent status from any GameObject that has it.

Set Scene visibility and pickability

Click the Scene visibility icon to hide and show GameObjects in the Scene view An interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary without changing their in-application visibility.

Select the Scene picking icon to toggle the ability to select GameObjects in the Scene view while you are editing.

These controls are useful for working with large or complex Scenes where it’s difficult to view and select specific GameObjects.

Scene visibility icons/toggles

For more information, see the documentation on Scene visibility and Scene picking.

Sort GameObjects

By default, the Hierarchy window lists GameObjects in the order they’re created. You can drag the selected GameObject up or down in the Scene to change the order of the GameObjects.

Alphanumeric sorting

To sort GameObjects in alphanumeric order:

  1. Select Edit > Preferences (Windows) or Unity > Preferences (macOS).
  2. Select Enable Alphanumeric Sorting.

When selected, an icon appears in the Hierarchy window that allows you to toggle between Transform sorting (the default value) or Alphabetical sorting.

Multi-Scene editing

You can have more than one Scene open in the Hierarchy window at the same time. For more information, see the Multi Scene Editing page.

Override indicator

When you edit a Prefab instance in a Scene, Unity displays a indicator next to the parent GameObject in the hierarchy. This indicator highlights any Prefab that has non-default override values in any of its child GameObjects. To open the Overrides dropdown directly from the Hierarchy window click on the override indicator. The override indicator appears as a blue line in the left side of the margin and is identical to the instance override in the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary window. For more information, see Instance overrides.

The Hierarchy Window

The Hierarchy contains every GameObject in the current Scene. Some of these are direct instances of asset files like 3D models, and others are instances of Prefabs, custom objects that will make up much of your game. You can select objects in the Hierarchy and drag one object onto another to make use of Parenting (see below). As objects are added and removed in the scene, they will appear and disappear from the Hierarchy as well. By default the GameObjects will be listed in the Hierarchy window in the order they are made. It is possible to re-order the GameObjects by dragging them up or down, or making them children or parents.

Parenting

Unity uses a concept called Parenting. To make any GameObject the child of another, drag the desired child onto the desired parent in the Hierarchy. A child will inherit the movement and rotation of its parent. You can use a parent object’s foldout arrow to show or hide its children as necessary. Alt-clicking the parent’s foldout arrow will show or hide all descendent GameObjects of the parent, in addition to the immediate children.

Two unparented objectsTwo unparented objects One object parented to anotherOne object parented to another

To learn more about parenting, see the Transform Component page.

Alphanumeric Sorting

The order of GameObjects in the Hierarchy window can be changed into alphanumeric order. This mode can be enabled using the Edit->Preferences menu (Windows) or Unity->Preferences menu (Mac) which launches the Unity Preferences window. The “Enable Alpha Numeric Sorting” can be ticked. Once this is made the order of the GameObjects in the Hierarchy can be made into alphanumberic sorting. A new icon appears at the top right-hand side of the Hierarchy window. A drop-down appears which lets you choose Alphabetic or Transform sort.

Multi-Scene Editing

It is possible to have more than one Scene open in the Hierarchy at the same time. To find out more about this, see the Multi Scene Editing page.

За что отвечает вкладка hierarchy в unity

The default Hierarchy window view when you open a new Unity projectThe default Hierarchy window view when you open a new Unity project

The Hierarchy window displays every GameObject in a Scene, such as models, Cameras, or Prefabs . You can use the Hierarchy window to sort and group the GameObjects you use in a Scene. When you add or remove GameObjects in the Scene view, you also add or remove them from the Hierarchy window.

Читать:
Hd videobox какой плеер установить

The Hierarchy window can also contain other Scenes, with each Scene containing their own GameObjects.

Unity uses the concept of parent-child hierarchies, or parenting, to group GameObjects. An object can contain other GameObjects that inherit its properties.You can link GameObjects together to help move, scale, or transform a collection of GameObjects. When you move the top-level object, or parent GameObject, you also move all child GameObjects.

You can also create nested parent-child GameObjects. All nested objects are still descendants of the original parent GameObject, or root GameObject.

Child GameObjects inherit the movement and rotation of the parent GameObject. To learn more about this, see documentation on the Transform component.

 Child 1 and Child 2 are the child GameObjects of Parent. Child 3 is a child GameObject of Child 2, and a descendant GameObject of Parent.Child 1 and Child 2 are the child GameObjects of Parent. Child 3 is a child GameObject of Child 2, and a descendant GameObject of Parent.

Organizing GameObjects

Creating new GameObjects

To create a new GameObject in the Hierarchy window:

  1. Right-click on empty space in the selected Scene.
  2. Select the GameObject you want to create.

You can also press Ctrl+Shift+N (Windows) or Command+Shift+N (macOS) to create a new empty GameObject.

Note: New GameObjects are created in “rename” mode automatically. To disable this behavior, select the More (⋮) menu in the Hierarchy window and deselect Rename New Objects.

Toggling child GameObject visibility

To toggle the visibility of child GameObjects:

  1. Select the drop-down arrow (►) to the left of the parent GameObject.
  2. Press Alt while clicking the drop-down arrow (►) to toggle visibility of all descendant GameObjects of the root GameObject.
  3. Select the drop-down arrow again (▼) to collapse all descendant GameObjects.

Creating child GameObjects

To create a child GameObject:

  • Drag the GameObject onto the parent GameObject in the Hierarchy.

Creating parent GameObjects

You can add a new GameObject into the Hierarchy view as the parent of existing GameObjects.

To create a parent GameObject:

  1. Right-click a GameObject, or select multiple GameObjects on the same level and right-click.
  2. Select Create Empty Parent.

You can also press Ctrl+Shift+G (Windows) or Command+Shift+G (macOS) to create a parent GameObject.

Note: If you have set a default parent GameObject, Create Empty Parent creates the new GameObject as a child of the default parent, not as the parent of the selected GameObjects.

Creating sibling GameObjects

A sibling GameObject is a GameObject with the same hierarchy as another child GameObject. To create a sibling GameObject:

  1. Drag the GameObject above or below an existing GameObject.
  2. Use the horizontal blue line to determine the order of the GameObject.

Duplicating GameObjects

To duplicate GameObjects, right-click the target GameObject and select Duplicate.

You can also press Ctrl+D (Windows) or Command+D (macOS) to duplicate the selected GameObject.

Pasting GameObjects as child

You can cut or copy a selected GameObject and then paste it as a child of another GameObject. Pasted child GameObjects keep their world position.

To paste a GameObject as child:

  1. Right-click the selected GameObject, and then select Cut or Copy.
  2. Right-click the intended parent GameObject, and then select Paste as Child.

You can also press Ctrl+Shift+V (Windows) or Command+Shift+V (macOS) to paste a GameObject as a child.

Organizing GameObjects with default parent

You can make any GameObject in the Hierarchy window a “default parent”. When you drag a GameObject into the Scene view, Unity automatically makes this GameObject the child of the GameObject you set as the default parent.

To make a GameObject a default parent:

  1. In the Hierarchy window, right-click on the GameObject.
  2. Select Set as Default Parent.

When you drag a GameObject into the Scene view, in the Hierarchy window, the child GameObject is indented below the default parent GameObject. The name of the default parent GameObject is bold.

In this image, the Cube GameObject is the default parent. When the user drags the Car GameObject into the Scene view, Unity automatically makes it the child of the Cube GameObject.In this image, the Cube GameObject is the default parent. When the user drags the Car GameObject into the Scene view, Unity automatically makes it the child of the Cube GameObject.

To remove default parent status from a GameObject:

  1. In the Hierarchy window, right-click on the GameObject.
  2. Select Clear Default Parent.

The name of the GameObject that was previously the default parent is no longer bold. When you drag a GameObject into the Scene view, it appears at the top level in the Hierarchy window. In other words, Unity does not make this GameObject the child of the GameObject that was previously the default parent.

In this image, no GameObjects in the Hierarchy window are set as the default parent. When the user drags the Car GameObject into the Scene view, Unity adds it at the top level of the hierarchy.In this image, no GameObjects in the Hierarchy window are set as the default parent. When the user drags the Car GameObject into the Scene view, Unity adds it at the top level of the hierarchy.

You can only set one default parent per Scene. In the Hierarchy window, if you set a GameObject as the default parent, and then you make a different GameObject in the same Scene the default parent, only the second GameObject is the default parent.

If you have multiple Scenes in the Hierarchy window, and you set default parents in each Scene, when you drag a GameObject into the Scene view, Unity makes the default parent GameObject in the active Scene the parent of the new GameObject.

In this image, the Cube GameObjects in both Scene1 and Scene2 are set as default parents. Unity sets the Cube in Scene1 as the parent of the Car GameObject, because Scene1 is the active Scene.In this image, the Cube GameObjects in both Scene1 and Scene2 are set as default parents. Unity sets the Cube in Scene1 as the parent of the Car GameObject, because Scene1 is the active Scene.

You can set a keyboard shortcut for the default parent setting in the Shortcuts manager. On the Shortcuts window, assign a keyboard shortcut to Hierarchy View > Set as Default Parent. If there is no default parent set, and in the Hierarchy window you select a GameObject, use the shortcut to make this GameObject the default parent. When a default parent is set, use the shortcut to remove default parent status from any GameObject that has it.

Setting Scene visibility and pickability

Click the Scene visibility icon to hide and show GameObjects in the Scene view without changing their in-application visibility.

Select the Scene picking icon to toggle the ability to select GameObjects in the Scene view while you are editing.

These controls are useful for working with large or complex Scenes where it’s difficult to view and select specific GameObjects.

Scene visibility icons/toggles

For more information, see the documentation on Scene visibility and Scene picking.

Sorting GameObjects

By default, the Hierarchy window lists GameObjects in the order they’re created. You can drag the selected GameObject up or down in the Scene to change the order of the GameObjects.

Alphanumeric sorting

To sort GameObjects in alphanumeric order:

  1. Select Edit > Preferences (Windows) or Unity > Preferences (macOS).
  2. Select Enable Alphanumeric Sorting.

When selected, an icon appears in the Hierarchy window that allows you to toggle between Transform sorting (the default value) or Alphabetical sorting.

Multi-Scene editing

You can have more than one Scene open in the Hierarchy window at the same time. For more information, see the Multi Scene Editing page.

1.2. Как работать с Unity

В предыдущем разделе мы много говорили о том, как выгоден встроенный в Unity визуальный редактор с точки зрения производительности, а сейчас пришло время познакомиться с его интерфейсом и узнать, как он работает. Если вы пока этого не сделали, скачайте программу со страницы http://unity3d.com/ru/get-unity и установите на свой компьютер (обязательно установите флажок Example Project , если установщик его сбросит). После этого запустите Unity, чтобы приступить к исследованию интерфейса.

Вам, скорее всего, потребуется пример, поэтому откройте соответствующий проект; при установке новой копии этот проект должен предлагаться автоматически, но вы можете выбрать в меню File команду Open Project и открыть его вручную. Он находится в пользовательской папке общего доступа, адрес которой в операционных системах семейства Windows выглядит примерно так: C:\Users\Public\Documents\Unity Projects\ , а в Mac OS — так: Users/Shared/Unity/ . Если заодно потребуется открыть пример сцены, дважды щелкните на файле Car (рис. 1.9 демонстрирует, что такие файлы в Unity обозначаются символом куба). Значок этого файла в средстве просмотра файлов, расположенном в нижней части редактора, находится по адресу SampleScenes/Scenes/ . Вы должны получить экран, показанный на рис. 1.9.

а ƒ а а-а а Play

Па ˆ Hierarchy • а‚а

В а Project Console

В • а€ а а а‚ • а а ƒ Car

Рис. 1.9. Части интерфейса Unity

Интерфейс Unity разбит на несколько частей: вкладка Scene , вкладка Game , панель инструментов, вкладка Hierarchy , панель Inspector , вкладки Project и Console . У каждой

28 Глава 1 . Знакомство с Unity

части есть собственное предназначение, при этом все они играют важную роль в цикле создания игры:

Просмотр файлов выполняется на вкладке Project .

Помещенные в трехмерную сцену объекты просматриваются на вкладке Scene .Панель инструментов предоставляет вам элементы управления сценой.

Менять взаимосвязи между объектами можно методом перетаскивания на вкладке Hierarchy .

Панель Inspector отображает информацию о выделенных объектах, в том числе и о связанном с ними коде.

Тестировать полученные результаты можно на вкладке Game , одновременно просматривая сообщения об ошибках на вкладке Console .

Эта компоновка предлагается по умолчанию; все доступные представления помещены на вкладки, которые можно перемещать, можно менять их размер и фиксировать в разных частях экрана. Чуть позже вы поэкспериментируете с выбором компоновки, пока же нам нужно понять назначение каждого элемента интерфейса, поэтому вариант, предлагаемый по умолчанию, является оптимальным.

1.2.1. Вкладка Scene, вкладка Game и панель инструментов

Наиболее заметной частью интерфейса является расположенная в центре вкладка Scene . Именно здесь можно видеть, как выглядит мир игры, и перемещать объекты в сцене. Сеточные объекты в сцене выглядят, как им и положено, в виде сеток. Также можно наблюдать и ряд других объектов, представленных различными значками и цветными линиями. Это камеры, источники света, источники звука, области столкновений и т. п. Разумеется, наблюдаемая тут картинка отличается от того, что вы будете видеть в процессе игры, — можно рассматривать сцену, не ограниваясь игровым представлением.

ОПРЕДЕЛЕНИЕ Сеточный объект (mesh object) — это визуализация объекта в трехмерном пространстве. Она создается из набора соединенных друг с другом линий и форм, которые формируют сетку.

Игровое представление отображается не на отдельной части экрана, а на вкладке Game , расположенной рядом с вкладкой Scene (переход с вкладки на вкладку осуществляется с помощью кнопок в верхнем левом углу области отображения). В интерфейсе есть и другие элементы, сконструированные подобным образом; для изменения отображаемого ими содержимого достаточно перейти на другую вкладку. После запуска игры начинает отображаться игровое представление, то есть вам не нужно переходить на вкладку Game — переключение выполняется автоматически.

СОВЕТ В режиме воспроизведения игры можно вернуться на вкладку Scene для просмотра объектов. Это крайне полезная возможность, позволяющая понять, как выглядит воспроизводимая игра изнутри и что в ней происходит. Подобный инструмент отладки отсутствует в большинстве игровых движков.

Для запуска игры достаточно щелкнуть на кнопке Play , расположенной над вкладкой Scene . Вся верхняя часть интерфейса занята так называемой панелью инструментов,

1.2. Как работать с Unity 29

и кнопка Play находится как раз в центре этой панели. Рисунок 1.10 получен отбрасыванием остальной части интерфейса редактора и демонстрирует только панель инструментов с расположенными под ней вкладками Scene и Game .

Похожие статьи