Chapter 3: Edit
In this lesson we’re going to be taking a look at the “Edit” drop-down menu. The Edit drop-down menu may seem extensive and tedious, but learning it will help provide a solid foundation for your future as a game developer working in Unity. The most important concepts here are those of “Tags and Layers.”
Fig. 3.1 illustrates the Edit drop-down menu.
Much of the Edit menu is typical; Undo, Redo, Cut, Copy, Paste. Further down the menu, Duplicate and Delete should likewise be familiar and self-explanatory. It is worth mentioning though that there are some distinguishing features between Duplicate and a Copy and Paste procedure. First of all, Duplicate is one less operation for the user. This may seem insignificant but as game developers we’re always looking for ways to do things in one less operation. Cumulatively this, coupled with other transactional shortcuts, will pay huge time saving dividends. Always remember that time is money. Another important difference between duplicate and copy and paste is that you can copy and paste across scenes. It is possible to copy a GameObject in one scene, open another scene, and paste it in. Game Objects will be covered in detail in lesson 5.
Skipping back a bit, Select All (Ctrl+A) selects everything in the chosen View or panel. Selecting a folder in the left panel of the Project View will select everything in that folder (but not the subfolders) for the purposes of copying items across to the hiearchy. Deselect All is true to its name. As are Select Children (Parents and Children are covered in detail in Lesson 5), Select Prefab Root (Prefabs are covered in the next Lesson), and Invert Selection.
Frame Selected can be actuated by using F as a hotkey. If you select a Game Object in the Scene View and press F it will center in on the object. Moreover, if you select an object from the textual list in the Hierarchy View and then hover your mouse over the Scene View and press F, the selected object will be found and centered. This is especially useful for pinpointing Game Objects that you can’t currently see in Scene View.
Lock View to Selected (Shift+F) is aptly named. With it activated your Scene View’s view will follow the object you’ve selected. It will follow the object unless you manually move it out of view, in which case the functionality deactivates.
Find, (Ctrl+F) jumps your cursor to the search box of whatever view is currently selected (provided it contains a search box). It is one of the few functions that is just as efficiently accomplished by pointing and clicking; in this instance, pointing and clicking within the search fields at the top of the Project and Hierarchy Views.
Play, Pause, and Step are used to control the Game View. Play will initiate Play Mode (playtesting) and Pause will pause it. The Play Mode buttons are more readily accessible from the toolbar.
Sign in and Sign out refer to states of being within your Unity account. In the editor, it primarily affects your access to the Unity store. Occasionally Unity will demand two-factor authentication (2FA) to login. In addition to logging in, you will need to enter a one-time code that Unity sends to the email account registered with your Unity ID.
Selection allows you to save an object, objects, or multiple selections of objects using the hotkeys Ctrl+Alt+(number). You can then quickly access the selection using the hotkeys Ctrl+Shift+(number).
Project Settings spawns an entire View. We’ll look at some of the options now, but only briefly.
Knowledge of Audio, Time, TextMesh Pro and Script Execution Order, is, for the purposes of this course, inconsequential at this time. The default settings are adequate.
Editor opens up a whole host of Editor Settings in the Inspector Panel, only a few of which will be of much consequence to us. If you’re developing for Android, IOS, or smart TVs, know that Unity Remote refers to a downloadable app that helps with game testing in those environments. Unity Remote must first be installed and running on your device and connected to your computer before you open Unity. Then, clicking Device, you can point Unity to the app/associated hardware and test the game on your device in real time! This saves us from having to build and install to a device every time we want to test our game out. Note that if enabled, the Joystick Source defaults to Remote (the device) as opposed to any other computer-connected inputs. For the rest of the Editor Settings the defaults are fine.
Graphics allows you to specify what shaders should be always included with your build. Similar to Pixel Light Count it is an easily overlooked setting that can have significant impact on how good your game looks. This will also be covered in greater depth in the lesson on lighting.
Input allows you to reassign the default inputs on Unity’s most commonly used scripts. The defaults are adequate.
Physics offer Game Objects exceptionality. Physics works in conjunction with Layers to offer very specific exceptionality, that of exception or inclusion to Unity’s laws of physics (the most consequential of which is collision). In order to define that objects bearing particular Layers will not “physically” interact with one another, un-check the box in the collision matrix where those Layers intersect.
Fig. 3.4 Illustrates how to specify that GameObjects using customLayer1 not “physically” interact with GameObjects using customLayer2.
Physics2D is similar to Physics. The difference being, of course, that it applies to games being developed using Unity’s 2D framework.
Player is an alternate way to open up Player Settings, introduced earlier. We’ll look at these settings in an in-depth fashion when we are ready to build our game.
Preset Manager can be used to specify the default parameters for Asset Importers and newly added Components. For our purposes however, it is not necessary to do so.
Quality allows you to specify the visual fidelity of your built game according to several presets that can be selected by the player. Perhaps the most easily overlooked parameter with the greatest consequence in the Quality Inspector View is Pixel Light Count. It will be covered in the lesson on lighting.
Tags and Layers offers very important functionality. Adding Tags to objects allows you to select them from Scene’s objects procedurally; that is, using code or state machine operations such as those found in Playmaker. Layers offer Game Objects exceptionality. A Layer is assigned to an object in order to either include or exclude that object in a rule specified by a script or state machine operations. For example, if you have ghosts in your scene and you want bullets to pass through them, you would assign the ghost a Layer (in this instance the built-in Layer IgnoreRaycast) and then add that Layer as an exception to the script or state machine operation responsible for calculating bullet collisions (in this instance, Raycast). We can add Tags and Layers here or more conveniently by selecting a Game Object and clicking on the Tag or Layer buttons in the Inspector View.
Fig. 3.3 shows the Tag and Layer buttons as they appear in the Inspector View with a Game Object selected.
VFX elicits yet another panel where you can specify the visual fidelity of your game. Here the defaults of None (Computer Shader) are adequate for now.
Note that when you select a Project Settings option, many of the panels that spawn have a Documentation/help, Select Preset, and/or Reset icon in the upper right-hand corner. Thus concludes our abridged tour of Project Settings.
Next in the Edit drop-down is Preferences. The options in the resulting Unity Preferences window define preferences for the editor itself rather than the settings of your game or Project. It is advisable to keep most of the default settings as they are. The exception is Colors. Make sure Playmode tint is set to red. The reasons will become apparent later on.
Fig. 3.2 illustrates the Project Settings drop-down menu.
Shortcuts is an all-new feature as of Unity 2019. Clicking Shortcuts opens the Shortcuts window, revealing a color-coded keyboard (white are unassigned keys, blue are assigned keys, and yellow are global keys) and a textual list of Commands. Here you are able to see which keys are currently occupied and the Commands they are occupied with. Simply hover over the picture of a key or select Commands from the textual list to set what has been assigned where. You can also search for assignments in the searchbar. To assign Commands or reassign Commands to a shortcut key, select the Category and then double-click the Command that you want. A field will appear in the Shortcut column. Press the key on your physical keyboard that you want that Command assigned to. Note that if there is a key assigned to that command already, it will be replaced. And if the command is assigned to a different key, it will be removed from that key. That is, you can’t have the same command assigned to multiple keys but in certain circumstances you can have multiple commands assigned to the same key. Once you have your shortcuts as you like, you can Create new profile… from the drop-down button in the upper left-hand corner. Subsequently you can Delete and Rename profile… and select from your previously created shortcut profiles.
It should not be necessary to Clear All PlayerPrefs. If you choose to, you will be confronted with the warning that clearing all PlayerPrefs cannot be undone. Whenever you see the “can’t be undone” warning, backup your Project before proceeding.
Graphics Tier allows you to emulate different end-user hardware. This is useful for testing your game on computers and devices that are weaker than yours and on computers and devices that are more powerful than what you are using to develop the game.
Finally, Snap Settings allows you to position GameObjects at intervals specified in the Unit Snapping View. It is activated by holding the Control key (Command on Mac).
Many of the functions provided in the Edit menu you have seen before in the majority of software. For the most part, it is important that you simply know of the options located here. Once again, the most important concepts are those of Tags and Layers. Be aware that there are important settings buried inconspicuously in the Quality and Graphics sub-menus that will affect how good your game looks. In the next lesson, Assets!