Home>Articles

This chapter is from the book

Getting to Know the Unity Editor

现在您已经统一安装,你就可以开始exploring the Unity editor. The Unity editor is the visual component that enables you to build games in a “what you see is what you get” fashion. Because most interaction you have is actually with the editor, many people refer to it as simplyUnity. This section examines the various elements of the Unity editor and how they fit together to make games.

The Projects Section

Not only is the Unity Hub where you manage your editor installations, it is where you create and select projects. At this point, the Projects section of the Hub is probably blank for you (seeFigure 1.4).

FIGURE 1.4

FIGURE 1.4The empty Projects section of the Hub.

In order to create a new project, all you have to do is clickNew. If you have multiple editor versions installed and you’d like to pick the version, you can do so by clicking the downward arrow next to the New button. Finally, if you want to open a project you’ve already created (and that isn’t in the project list already), you can do so by clickingADD. In the following exercise, you will see exactly how to create a new project.

The Unity Interface

So far, you have installed Unity and looked at the New Project dialog. Now it is time to dig in and start playing around. When you open a new Unity project for the first time, you see a collection of gray windows (calledviews), and everything is rather empty (seeFigure 1.6). Never fear; you will quickly get this place hopping. The following sections look at each of the unique views, one by one. First, though, let’s talk about the layout.

FIGURE 1.6

FIGURE 1.6The Unity interface.

For starters, Unity allows you to determine exactly how you want to work. Any of the views can be moved, docked, duplicated, or changed. For instance, if you click the wordHierarchy(on the left) to select the Hierarchy view and drag it over to the Inspector (on the right), you can tab the two views together. You can also place your cursor on any line between views and resize the windows. In fact, why don’t you take a moment to play around and move things so that they are to your liking? If you end up with a layout that you don’t much care for, you can quickly and easily switch back to the built-in default view by going toWindow > Layouts > Default Layout. While you are playing around, go ahead and try out a few of the other layouts. (I’m a fan of the Wide layout.) If you create a custom layout you like, you can save it by going toWindow > Layouts > Save Layout. (I used a custom layout called Pearson for the writing of this book.) After you’ve saved a custom layout, if you accidentally change the layout, you can always get it back. It is worth noting that you can also control the layouts through the Layouts drop-down, located in the upper right of the Unity editor; it is the drop-down that says Default inFigure 1.6.

Duplicating a view is a fairly straightforward process as well. You can simply right-click any viewtab(such as Inspector inFigure 1.7) and hover the mouse cursor overAdd Tab, and a list of views pops up for you to choose from (seeFigure 1.7). You may wonder why you would want to duplicate a view. Say that in a view-moving frenzy, you accidentally close a view. Re-adding the tab will give it back to you. Also, consider the capability to create multiple Scene views. Each Scene view could align with a specific element or axis within your project. If you want to see this in action, check out the 4 Split built-in layout by going toWindow > Layouts > 4 Split. (If you have already created a layout that you like, be sure to save it before you check out 4 Split.)

FIGURE 1.7

FIGURE 1.7Adding a new tab.

现在,闲话少说,我们来看看specific views in the Unity editor.

The Project View

Everything that has been created for a project (files, scripts, textures, models, and so on) can be found in the Project view (seeFigure 1.8). This is the window that shows all the assets and organization of a project. When you create a new project, you see a folder section called Assets. If you go to the folder on your hard drive where you save the project, you also find an Assets folder. This is because Unity mirrors the Project view with the folders on the hard drive. If you create a file or folder in Unity, the corresponding file or folder appears in the explorer (and vice versa). You can move items in the Project view simply by dragging and dropping. Unity enables you to place items inside folders or reorganize your project on the fly.

FIGURE 1.8

FIGURE 1.8The Project view.

When you click a folder in the Project view, the contents of the folder are displayed under the Assets section on the right. As you can see inFigure 1.8,资产部分包含一个文件夹,不结盟运动ed Scenes. If you open the Scenes folder, you see the contents of the folder—a single scene—listed on the right. To create assets, you simply click theCreatedrop-down (that is, the + drop-down). This menu enables you to add all manner of assets and folders to a project.

The Favorites buttons enable you to quickly select all assets of a certain type. This makes it possible to get an “at a glance” view of your assets. When you click one of the Favorites buttons (All Models, for instance) or perform a search with the built-in search bar, you can narrow down the results between assets and packages (or both; seeFigure 1.9). With a little practice, finding exactly what you need will become a breeze!

FIGURE 1.9

FIGURE 1.9Searching the Project view.

The Hierarchy View

In many ways, the Hierarchy view (seeFigure 1.10) is a lot like the Project view. The difference is that the Hierarchy view shows all the items in the current scene instead of in the entire project. When you first create a project with Unity, you get the default scene, which has just two items in it: the Main Camera and Directional Light game objects. As you add items to a scene, they appear in the Hierarchy view. Just as with the Project view, you can use theCreatemenu to quickly add items to your scene, search using the built-in search bar, and click and drag items to organize and nest them.

FIGURE 1.10

FIGURE 1.10The Hierarchy view.

The Inspector View

The Inspector view enables you to see all the properties of a currently selected item. Simply click any asset or object in the Project or Hierarchy view, and the Inspector view is automatically populated with information.

InFigure 1.11, you can see the Inspector view after the Main Camera object is selected from the Hierarchy view.

FIGURE 1.11

FIGURE 1.11The Inspector view.

Let’s break down some of the functionality available in the Inspector view:

arrow.jpgUnchecking the box next to an object’s name disables it and ensures that it does not appear in the scene. Objects are enabled (that is, their boxes are checked) by default.

arrow.jpgDrop-down lists (such as the Layer and Tag lists, which are discussed later) are used to select from a set of predefined options.

arrow.jpgText boxes, drop-downs, and sliders can have their values changed, and the changes are automatically and immediately reflected in the scene—even if the game is running!

arrow.jpgEach game object acts like a container for different components (such as Camera and Audio Listener inFigure 1.11). You can disable these components by unchecking them or remove them by right-clicking and selectingRemove Component.

arrow.jpgYou can add components by clicking theAdd Componentbutton.

The Scene View

The Scene view is the most important view you work with in Unity because it enables you to see your game visually as it is being built (seeFigure 1.12). Using the mouse controls and a few hotkeys, you can move around inside a scene and place objects where you want them. This gives you an immense level of control.

FIGURE 1.12

FIGURE 1.12The Scene view.

In a little bit, you will learn about moving around within a scene, but for now, let’s focus on the controls that are part of the Scene view:

arrow.jpgDraw mode:This controls how the scene is drawn. By default, it is set to Shaded, which means objects will be drawn with their textures in full color.

arrow.jpg2D/3D view:This control changes from a 3D view to a 2D view. Note that in 2D view, the scene gizmo (described later this hour) is not visible.

arrow.jpgScene lighting:This control determines whether objects in the Scene view are lit by default ambient lighting or only by lights that actually exist within the scene. The default is to include the built-in ambient lighting.

arrow.jpgAudition mode:This control sets whether an audio source in the Scene view functions.

arrow.jpgVisual effects:This control determines whether items like skyboxes, fog, and other effects appear in the Scene view.

arrow.jpgHidden objects:This control toggles the visibility of hidden objects in the Scene view.

arrow.jpgScene grid:This control allows you to configure the Scene grid.

arrow.jpgTools:This control toggles the Component Editor tool panel.

arrow.jpgScene camera:This control allows you to configure the Scene camera (the camera used to view the scene while editing).

arrow.jpg小发明本身lector:这使您能够选择控制gizmos—that is, indicators that help with visual debugging or aid in setup—appear in the Scene view. This control also determines whether the placement grid is visible.

arrow.jpgScene gizmo:This control shows which direction you are currently facing and aligns the Scene view with an axis.

The Game View

The last view we need to go over is the Game view. Essentially, the Game view allows you to “play” the game inside the editor by giving you a full simulation of the current scene. All elements of a game function in the Game view just as they would if the project were fully built.Figure 1.13shows what the Game view looks like. Note that although the Play, Pause, and Step buttons are not technically part of the Game view, they control the Game view and therefore are included in this figure.

FIGURE 1.13

FIGURE 1.13The Game view.

The Game view comes with some controls that assist with testing games:

arrow.jpgPlay:The Play button enables you to play the current scene. All controls, animations, sounds, and effects are present and working. Once a game is running, it should behave very similarly to how it would behave if it were actually being run in a standalone player (such as on your PC or mobile device). To stop a game from running, click thePlaybutton again.

arrow.jpgPause:The Pause button pauses the execution of the currently running Game view. When a game is paused, it maintains its state and stays exactly where it was when the Pause button was clicked. Clicking the Pause button again causes the game to continue running.

arrow.jpgStep:The Step button works while the Game view is paused and causes a single frame of the game to execute. This effectively allows you to “step” through the game slowly and debug any issues that exist. Clicking the Step button while the game is running causes the game to pause.

arrow.jpgAspect drop-down:From this drop-down menu, you can choose the aspect ratio you want for the Game view window while running. The default is Free Aspect, but you can change it to match the aspect ratio of the target platform you are developing for.

arrow.jpgMaximize on Play:This button determines whether the Game view takes up the entirety of the editor when run. By default, this option is turned off, and a running game is only the size of the Game view tab.

arrow.jpgMute Audio:This button turns off the sounds when playing the game. This is handy when the person sitting next to you is getting tired of hearing your repeated playtesting!

arrow.jpgStats:这个按钮确定呈现统计s are displayed on the screen while the game is running. These statistics can be useful for measuring the efficiency of a scene. The stats are turned off by default.

arrow.jpgGizmos:This is both a button and a drop-down menu. The button determines whether gizmos are displayed while the game is running. Game view gizmos are not displayed by default. The drop-down menu (the small arrow) on this button determines which gizmos appear if gizmos are turned on.

Honorable Mention: The Toolbar

Although not a view, the toolbar is an essential part of the Unity editor.Figure 1.14shows the toolbar components:

arrow.jpgTransform tools:These buttons enable you to manipulate game objects and are covered in greater detail in later hours. Pay special attention to the button that resembles a hand. This is the Hand tool, and it is described later this hour.

arrow.jpgTransform gizmo toggles:These toggles allow you to manipulate how gizmos appear in the Scene view. You can leave them alone for now.

arrow.jpgGame view controls:These buttons control the Game view.

arrow.jpgAccount and Services controls:These buttons allow you to manage the Unity account you are using as well as the services you are using in your project.

arrow.jpgLayers drop-down:This menu determines which object layers appear in the Scene view. By default, everything appears in the Scene view. Leave this alone for now. Layers are covered in Hour 5, “Lights and Cameras.”

arrow.jpgLayout drop-down:This menu allows you to quickly change the layout of the editor.

FIGURE 1.14

FIGURE 1.14The toolbar.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

调查和问题,我们收集inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simplyemailinformation@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through ourContact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on theAccount page. If a user no longer desires our service and desires to delete his or her account, please contact us atcustomer-service@informit.comand we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:www.e-skidka.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information toNevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read ourSupplemental privacy statement for California residentsin conjunction with this Privacy Notice. TheSupplemental privacy statement for California residentsexplains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • 调查或地址实际或可疑的夫人d or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Pleasecontact usabout this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020