Chapter 10: Toolbar

By | April 12, 2019

lesson 10: Toolbar

Though diminutive, the "Toolbar" is comprised of many commonly used tools: Transform tools and Playback buttons. In this lesson we'll look at the functionality provided by the Toolbar and hotkey selection. We'll learn about the "Too-Many-Dials" problem. We'll learn how to Translate (I.e. move, position, and scale) GameObjects. We'll learn the importance of pivot points and how to reassign a pivot point's location inside Unity.

 

Fig. 10.1 isolates the Toolbar

 

We've completed our tour of the Main Menu Bar and have moved onto the Toolbar. There are a number of icons, buttons, and drop-down menus here along the top. The icons in the first grouping are known as the Transform Tools. From left to right, these Tools are known as Hand Tool, Move Tool, Translate, Rotate, and Scale.

 

Fig. 10.2 shows the many icons of the Transform Tools.

 

Hand Tool, which is the hand icon, functions as if to grab the Scene and move it around. It helps you to navigate the Scene. Like all of the Transform Tools, it is woefully inefficient to activate the View Tool through icon interaction. Even its hotkey "Q" is not the best option for activation. The Hand Tool is most easily activated while in the Scene View by holding down the mouse scroll-wheel. Holding the alt key will swap the hand icon with an eye icon. This allows you functionality that, for practical purposes, is similar to rotating the scene. This functionality is more easily accessible by (first releasing the middle mouse button if necessary and) pressing and holding the right mouse button. If, while the hand icon is active, you first press "alt" and then press and hold the right mouse button, a magnifying glass icon appears. While this is most commonly associated with "zoom" functionality, in reality it allows you to dolly your view around the Scene. With all things View Tool, it has much more ergonomic activation; the scroll-wheel button can also be used to dolly your view of the Scene. ​​ 

 

Fig. 10.3 shows the Move Gizmo

 

A visual approach to GameObject positioning, the Translate Tool allows you to move GameObjects along X, Y, and Z axes in the Scene View. It is best activated using the hotkey "W." When activated in conjunction with a selected GameObject, a "Move Gizmo" appears. The colored arrows of the Gizmo each represent a different axis along which to move the selected GameObject. When an arrow is selected it highlights. Subsequent movement, accomplished by a click and drag motion, is constrained along the corresponding axis (x is red, y is green, z is blue). You can move a GameObject along multiple axes simultaneously by selecting the arrows' nexus but it is not recommended.

 

Fig. 10.4 shows the Rotate Gizmo

 

To rotate a GameObject, first activate the Rotate Tool with the hotkey "E (note that the Transform Tool hotkeys exist one after the other in the same order as their icons)." A "Rotate Gizmo" appears. Colored longitudinal and latitudinal lines correspond to x, y, and z axes. Selection of an arc will constrain rotation to its corresponding axis and rotation is accomplished by a click and drag motion. Free rotation (rotation in multiple axes simultaneously) is possible but discouraged.

 

Fig. 10.5 illustrates the Scale Gizmo

 

The Scale Tool, used for resizing GameObjects, is activated with hotkey "R." A "Scale Gizmo" will appear, complete with its own colored axes. The Scale Tool can be distinguished from the Translate Tool by its cube termini. Scaling a GameObject in a single dimension can be accomplished by selecting an axis and performing a click and drag motion. Unlike other Transform operations you'll usually want to scale uniformly (in multiple axes simultaneously). This is accomplished by selecting the nexus and dragging. In addition to resizing the GameObject, Scale re-sizes the GameObject's coordinate system as well. This means that any children of a Scaled GameObject will also become relatively larger or smaller. The child's Transform values, however, will not reflect its change in size (because it is in local space) unless the parent/child relationship is broken.

 

The aforementioned phenomenon provides us with a nice segue into a discussion of the "Too-Many-Dials" problem. The "too-many-dials" problem results from having one value that is controlled by several sometimes competing and conflicting settings. Maybe you've encounter this problem when trying to turn up the volume on your computer. You may have turned up the volume dial on your speakers or monitor to no avail. Then you tried turning up the volume using the icon in your OS's task-bar without result. There might have been middle-ware and hardware configurations to tinker with. Finally you had to turn up the volume in your media player to get the results you wanted. Of course after that you started with the media player volume only to find that this time, the speakers were the culprit. It never fails.

 

Pivot points are notorious for suffering from the "too-many-dials" problem (especially in Mecanim). A pivot point, which is a single point in space, is important because it is at that point that a GameObject's Transformation (translate, rotate, scale) is calculated. It is the point around which a GameObject pivots (and scales and translates). A GameObject's pivot point problems begin at creation. When you create a mesh in an external modeling program (such as 3ds Max, Maya, or Blender), its pivot point typically defaults to the center of the object. This can be edited however and placed arbitrarily by the artist. Upon import though, Unity tends to locate the pivot point wherever it pleases, overriding the location assigned or defined in the modeling program.

 

In addition to different software causing pivot point conflicts, the Toolbar toggle buttons Center/Pivot and Local/World can all override the Transformation locus. With Center active, transformations will be calculated beginning at the GameObject's center. With Pivot toggled, transformations will be calculated beginning at the GameObject's pivot point, which may or may not be the GameObject's center.

 

We discussed the difference between Local and World coordinates in a previous lesson and here those terms exist as a toggle button. Local makes your coordinates' system relative to the GameObject's pivot point and global makes the GameObject's location subordinate to the world coordinates system. What this means is that any transformations performed on a GameObject are performed on the GameObject's Local coordinate system as well (as alluded to in the instance of Scaling parent/child GameObjects).

So when you rotate a cube GameObject, you are also rotating its local x, y, z coordinates. They are subjective. This is perhaps easier to understand with an example.

 

  • Open Scene sec1Chap10Toolbar

  • Select and center the Cube

  • Press W to activate the Move Gizmo

  • Note that the Move Gizmo's axes run parallel and perpendicular to the Scene grid

  • Select an axis of the Move Gizmo and click and drag to Translate (move) it

  • Note that it slides along at either a parallel or perpendicular angle

  • Click the Toolbar's Global (World) toggle to switch it to Local

  • Press E to activate the Rotate Gizmo

  • Select the outer most orbit, click and drag to rotate the Cube

  • Note that the Z value in the Cube's Transform component changes

  • Press W to activate the Move Gizmo

  • Note that the cube's faces are no longer parallel and perpendicular to the Scene grid or the Move Gizmo's axes

Fig. 10.6 illustrates the changes to the Move Gizmo

  • Click the Toolbar's Local (World) toggle to switch it to Global

  • Note that the Move Gizmo's axes once again run parallel and perpendicular to the Scene grid; the Cube is now in a Global coordinate system.

 

As a practical matter, none of this need be worried about. Positioning GameObjects is more art than science most of the time. How you go about it when you position objects manually, World or Local, matters little. It can be frustrating, however, to select a GameObject and realize that its pivot point is nowhere to be found. Switching Pivot Point to Center can of course solve this, but even a step as small as this can ruin efficiencies if done enough. Moreover, scripts and Playmaker calculate Transformations from the pivot point. Never mind ruining efficiencies, if a pivot point isn't where you think it is, it can ruin the intended outcome of scripts, the PlayMaker State Machine, and ultimately the game! This begs the question, how do you define a pivot point inside Unity? You can't. There is a workaround however:

 

  • Right click in the Hierarchy View and select Create Empty from the drop down menu

  • To rename the GameObject, select the empty GameObject and in the Inspector View type "cubePivotPoint" into the first text field

  • Select the cubePivotPoint in the Hierarchy and press W to ensure the Move Gizmo is active

  • Position the cubePivotPoint just above the Cube

  • In Hierarchy, select Cube and drag and drop it onto cubePivotPoint to create a parent/child relationship

  • Ensure the Pivot/Center toggle on the Toolbar is set to Pivot

  • Select cubePivotPoint, press E and rotate

  • Note that the cube is no longer using its own Pivot point and that it's using cubePivotPoint's locus instead

  • You've created an ad hoc pivot point!

Fig. 10.7 illustrates an ad hoc pivot point

 

Now when you specify an ad hoc pivot point (eg cubePivotPoint) as the GameObject representing it's child (eg Cube), scripts and/or the PlayMaker State Machine will perform Transform calculations on the ad hoc pivot point's location.

 

In the interest of a flowing narrative, you'll notice I skipped over the Rect Tool and the Move, Rotate, or Scale selected objects tool. They're pretty skip-worthy. Rect Tool allows you to scale objects non-uniformly by pushing and pulling control points. The Move, Rotate, or Scale selected objects tool combines the Move, Rotate, and Scale tools into one gizmo. Personally, I like to operate in singular vectors, one at a time using the hot keys.

 

Fig. 10.8 shows the Play Mode grouping

 

The next grouping of Toolbar Tools are the "Play Mode" buttons. Play Mode buttons control the Game View. To test your Scene by playing it, click the "Play" button. To pause the game, use the "Pause" button. To step play, use the "Step" button. To exit game-play, click the Play button a second time. Play Mode will be discussed in greater depth along with the Game View.

 

Next up is a button marked Collab that drops down to reveal a “Start now!” button. According to the window that appears, Collab allows you to “quickly and easily access your project from anywhere. Sync and share with the entire team.” Collab works like Github, in that it seems to act like a version control system, but is customized for use with Unity Projects. It allocates cloud storage space for Projects and allows you to manage user access through a web-interface. The amount of storage you are allocated and the number of users allowed access to your Project scale by how much you pay. Luckily activation begins at the low, low price of $0. To activate Collab you must first turn it “On” in the Services View, which, conveniently enough, is spawned by clicking the next button.

 

The next button has a cloud icon and elicits the Services tab. This is redundant of the Services selection in the Window drop-down which was covered in a previous lesson.

 

Account allows you to manage account administration options. It's usability is similar to the account administration options available at Unity's website.

 

Fig. 10.9 shows the Layers drop-down menu

 

At the right most of the Toolbar are the drop-down menus "Layers" and "Layout." Previously it was said that Layers are used to add exceptionality to GameObjects. Here Layers are used primarily for organizational purposes. To the right of each of the Layers is an eye icon and a lock icon. Both can be toggled on and off. If the eye icon is toggled closed, any GameObject belonging to that layer will be made invisible in the Scene View. Again, this is for organizational purposes and editing convenience only. The GameObjects are still active and can be seen in the Game View (and by extension, when the game is played). Toggling the lock icon has no discernible effect. Edit Layers can be accessed from this drop-down as well.

 

We examined the Layout sub-menu in a previous lesson. Layout is accessible here in the Toolbar as well. The options here are identical to those found under Window.

​​ 

In this lesson we learned all about the Toolbar. The "too-many-dials" problem and how it relates to pivot points was discussed. We performed a dirty hack that allowed us to create an ad hoc pivot point. We also learned how to Translate, Rotate, and Scale GameObjects. By using the Layers drop-down menu, we learned how to hide GameObjects for our convenience while editing. Finally, we found an alternate way to access the Layout sub-menu. We're now going where the action is! To the Views!

 

 

 

No-Code Video Game Development With Unity3D and Playmaker  ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ 04/02/19

Michael Kelley  ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ page 9 of 9

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.