Unity3D: Hierarchy window

Recommended: Add NSDT Scene Editor to your 3D toolchain
3D Toolset: NSDT Jane Stone Digital Twins

Hierarchy window

The default Hierarchy window view when opening a new Unity project

The Hierarchy  window displays every game object in the scene, such as models, cameras or prefabs. The GameObjects used in the scene can be sorted and grouped using the Hierarchy window. When game objects are added or removed from the Scene view, they are also added or removed from the Hierarchy window.

The Hierarchy window can also contain other scenes, each containing its own GameObject.

parenting

Unity uses the concept of a parent-child hierarchy, or parenting, to group game objects. An object can contain other game objects that inherit its properties. GameObjects can be linked together to help move, scale, or transform collections of GameObjects. When you move the top-level or parent GameObject, all child GameObjects are also moved.

It is also possible to create nested parent-child game objects. All nested objects are still descendants of the original parent game object or the root game object.

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

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

Organize game objects

Create new game object

To create a new game object in the Hierarchy window:

  1. Right-click on an empty area of ​​the selected scene.
  2. Select the Game Object to create.

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

NOTE : New game objects are automatically created in "rename" mode. To disable this behavior, select the More (⋮) menu in the Hierarchy window and deselect  Rename New Objects .

Toggle child game object visibility

To toggle the visibility of child game objects:

  1. Select the dropdown arrow (►) to the left of the parent game object.
  2. Alt - click   the dropdown arrow (►) to toggle the visibility of all descendant GameObjects of the root GameObject.
  3. Select the drop down arrow (▼) again to collapse all descendant game objects.

Create child game objects

To create a child game object:

  • In the Hierarchy window, drag the game object onto the parent game object.

Drag Object 4 (selected object) to the parent Game Object Object 1 (highlighted in blue) to create a child Game Object.

Create parent game object

New Game Objects can be added to the Hierarchy View as parents of existing Game Objects.

To create a parent game object:

  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 game object.

Note : If a default parent game object is set, Create Empty Parent will create the new game object as a child of the default parent, not as a parent of the selected game object.

Create a sibling game object

A sibling GameObject is a GameObject that has the same hierarchy as another child GameObject. To create a sibling game object:

  1. Drag a GameObject above or below an existing GameObject.
  2. Use the horizontal blue lines to determine the order of the game objects.

Drag Object 4 (the selected object) between Object 2 and Object 3 (indicated by the blue horizontal line) to create a sibling Game Object below the parent Game Object Object 1 (highlighted in blue).

copy game object

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

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

Paste game objects as children

A selected Game Object can be cut or copied and then pasted as a child of another Game Object. Pasted child GameObjects retain their world positions.

To paste a GameObject as a child:

  1. Right-click on the selected game object and choose  Cut  or  Copy .
  2. Right-click on the intended parent GameObject and select  Paste as Child .

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

Organize game objects with default parent

Any Game Object in the Hierarchy window can be set as the "Default Parent". When you drag a GameObject into the Scene view, Unity automatically makes that GameObject a child of the GameObject set as the default parent.

To make a GameObject the default parent:

  1. In the Hierarchy window, right-click on the game object.
  2. Select  Set as default parent .

When a GameObject is dragged into the Scene View, the child GameObject is indented below the default parent GameObject in the Hierarchy window. The name of the default parent game object is bold.

In this diagram, the Cube game object is the default parent. When the user drags the Car game object into the Scene view, Unity automatically makes it a child of the Cube game object.

To remove the default parent state from a game object:

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

The name of a GameObject that was previously the default parent is no longer bold. When a game object is dragged into the Scene view, it appears on top of the Hierarchy window. In other words, Unity will not make this Game Object a child of a Game Object that was previously the default parent.

In this image, there are no game objects in the Hierarchy window set as default parents. When the user drags the Car game object into the Scene view, Unity adds it at the top of the hierarchy.

Only one default parent can be set per scene. In the Hierarchy window, if you set one GameObject as the default parent, and then set a different GameObject in the same scene as the default parent, only the second GameObject will be the default parent.

If you have multiple scenes in the Hierarchy window, and you set a default parent in each scene, when you drag a game object into the Scene view, Unity will set the default parent game object in the active scene as the new game object parent of .

In this image, the Cube game objects in Scene1 and Scene2 are set as default parents. Unity sets the Cube in Scene1 as the parent of the Car game object because Scene1 is the active scene.

Keyboard shortcuts can be set for default parent settings in Shortcuts Manager. In the Shortcuts window, assign the keyboard shortcut to  Hierarchy view  >  Set as Default Parent . If no default parent is set and a game object is selected in the Hierarchy window, use the shortcut key to set this game object as the default parent. After setting the default parent, use the shortcut key to remove the default parent state from any game object that has it.

Set scene visibility and selectability

Click the Scene Visibility icon to hide and show game objects in the Scene view without changing their visibility in the application.

Selecting the Scene Picker icon toggles whether Game Objects can be selected in the Scene view during editing.

These controls are useful when working with large or complex scenes where it is difficult to see and select specific game objects.

Scene visibility icon/switch

See the Scene Visibility and Scene Picking documentation for more information.

Sort game objects

By default, the Hierarchy window lists game objects in the order they were created. Selected game objects can be dragged up or down in the scene to change the order of the game objects.

Alphanumeric sort

To sort GameObjects alphanumerically:

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

When selected, an icon will appear in the Hierarchy window, allowing   switching between Transform  sorting (the default) or  Alphabetical sorting.

Multi-scene editing

Multiple scenes can be open simultaneously in the Hierarchy window. See the multi-scene editing page for more information.

coverage indicator

When editing a Prefab instance in the scene, Unity displays an indicator next to the parent GameObject in the hierarchy. This indicator highlights any prefabs that have non-default override values ​​in any of their child GameObjects. To open the Override drop-down list directly from the Hierarchy window, click the override indicator. The overlay indicator appears as a blue line on the left side of the margin, the same as the instance overlay in the Inspector window. For more information, see Instance Overrides.

This image shows the override indicator displayed next to Prefab A when Prefab A's child GameObject C has a non-default value.

This article is organized and translated by 3D Modeling Learning Studio , please indicate the source for reprinting!

Previous: Unity3D: Extended Device Simulator (mvrlink.com)

Next: Unity3D: Operating in the Inspector (mvrlink.com)

Guess you like

Origin blog.csdn.net/ygtu2018/article/details/131409988