Scene navigation and keyboard shortcuts - Unity in Action: Multiplatform game development in C# with Unity 5 (2015)

Unity in Action: Multiplatform game development in C# with Unity 5 (2015)

Appendix A. Scene navigation and keyboard shortcuts

Operating Unity is done through mouse and keyboard, but it isn’t obvious to a newcomer how the mouse and keyboard are used in Unity. In particular, the most basic sort of mouse and keyboard input is navigating around the scene and looking around the 3D objects. Unity also has a number of keyboard commands for commonly used operations.

I’ll explain the input controls here, but there are also a couple of web pages you could refer to (these are the relevant pages in Unity’s online manual):

· http://docs.unity3d.com/Documentation/Manual/SceneViewNavigation.html

· http://docs.unity3d.com/Documentation/Manual/UnityHotkeys.html

A.1. Scene navigation using the mouse

Scene navigation is primarily done with three main navigation maneuvers: Move, Orbit, and Zoom. The three different movements involve clicking and dragging while holding down some combination of Alt (or Option on the Mac) and Control. The exact controls vary for one-, two-, and three-button mice; table A.1 lists all the controls.

Table A.1. Scene navigation controls for various kinds of mice

Navigation action

Three-button mouse

Two-button mouse

One-button mouse

Move

Middle button click/drag

Alt+Command+left-click/drag

Alt+Command+click/drag

Orbit

Hold Alt+left-click/drag

Alt+left-click/drag

Alt+click/drag

Zoom

Hold Alt+right-click/drag

Alt+right-click/drag

Alt+Ctrl+click/drag

Note

Although Unity can be used with one- or two-button mice, I highly recommend getting a three-button mouse (and yes, a three-button mouse works fine on Mac OS X).

Besides the navigation maneuvers done using the mouse, there are also some view controls based on the keyboard. If you hold down the right button on the mouse, the WASD keys on the keyboard can be used to walk around in the manner common to most first-person games. Hold Shift during any other control to move faster. But most important, if you press F while an object is selected, the view will pan and zoom to focus on that object. If you get lost while navigating your scene, a common “escape hatch” is to select an object listed in the Hierarchy and then press F.

A.2. Commonly used keyboard shortcuts

Unity has a number of keyboard commands to quickly access important functions. The most important keyboard shortcuts are W, E, R, and T: those buttons activate the transform tools Translate, Rotate, and Scale (refer back to chapter 1 if you don’t recall what the transform tools do) as well as the 2D Rect tool. Because those keys are right next to each other, it’s common to leave your left hand on those keys while your right hand operates the mouse.

In addition to the transform tools, there are a number of keyboard shortcuts; table A.2 lists many useful keyboard shortcuts in Unity.

Table A.2. Useful keyboard shortcuts

Keystroke

Function

W

Translate (move the selected object)

E

Rotate (rotate the selected object)

R

Scale (resize the selected object)

T

Rect tool (manipulate 2D objects)

F

Focus view on the selected object

V

Snap to vertices

Ctrl/Command+Shift+N

New GameObject

Ctrl/Command+P

Play game

Ctrl/Command+R

Refresh project

Ctrl/Command+1

Set current window to Scene view

Ctrl/Command+2

Set to Game view

Ctrl/Command+3

Set to Inspector view

Ctrl/Command+4

Set to Hierarchy view

Ctrl/Command+5

Set to Project view

Ctrl/Command+6

Set to Animation view

Unity responds to a number of other keyboard shortcuts as well, but they get increasingly obscure the further down the list we get.