Unity Game Engine: Getting Used to the Editor
In my previous post, we discussed what a game engine is and what the benefits are of choosing Unity. I also walked through the steps to getting the Personal version of Unity and what you will see once you created your first project. In this post, I will walk through what each section does and how it is used when creating a game.
This is the main interface that the user will see when they are creating their games/applications using Unity. The current look is how the Default windows are set up. You are able to move windows around and even close them if you wish by right clicking on the tab and then selecting “Close Tab”. These windows, and many more can be opened back up by going to Window and then selecting which one you would like to open.
As you can see by the setup, there are four main windows and a toolbar that the user has access to at any given moment. The Toolbar gives access to the main tools and features that are most commonly and frequently used by developers. The Hierarchy Window gives a text representation of every single game object that is currently in the scene open at that moment. The Scene View is where you can navigate and edit your scene visually in 2D or 3D. The Inspector Window is where you can edit all of the properties of the selected game object. Lastly, the Project Window is where all of your projects assets are held and displayed to be placed into the scene.
This is just a brief overview of the windows. Lets jump into a more in depth look at each area.
The Toolbar consists of the main controls that are used when manipulating the scene.
The tools at the top left consist of the Hand Tool, Move, Rotate, Scale and RectTransform.
The Hand Tool allows the user to click and drag the camera around the scene. While holding Alt and clicking the move tool will allow the Camera to orbit around the current pivot point. Note, this is only available for 3D scenes. When Alt+right click is held, you will be able to zoom in and out when dargging the mous. Control+click works as well.
The Move Tool will allow a Game Object to be moved around the scene. By selecting one of the 2D squares, in the Gizmo will allow you to move along that plane.
The Rotate Tool allows the user to change the Game Objects rotation by clicking and dragging the axes on the Gizmo. The red is the x-axis, green is the y-axis and blue is the z-axis. The outermost axis will rotate the Game Object around the scene views z-axis.
The Scale Tool will allow you to rescale the Game Object by selecting and moving the Gizmos handles. By selecting the innermost square, you can scale the entire Game Object evenly. Be careful when using this tool as it can distort the children of Game Objects within the scene.
Lastly the RectTransform Tool is most commonly used for positioning 2D elements such as Sprites or UI elements. It can be useful for manipulating 3D Game Objetcts. It combines moving, rotation and scaling all into one Gizmo.
The other tools in the toolbar relate to position and rotation. These can be broken down into two different styles.
The position can be either Pivot or Center. Pivot positions the Gizmo at the actual pivot point of the Game Objects mesh. Center positions the Gixmo at the center of the Game Objects rendered bounds. These allow for specific manipulation of Game Objects.
The rotation can also be broken down into either Local or Global. Local keeps the Gizmos rotation relative to the Game Objects rotation. The Global clamps the Gizmo to the world space orientation. Switching between Global and Local rotation can help when adjust Game Objects in the 3D scene.
The next part of the Toolbar is the Play, Pause and Step buttons. These are mainly used when working with the Game View as they manipulate the way the game is tested when it is running in real time.
Play allows the developer to play the scene that they currently have open in their scene view. This can be very helpful as attributes can be changed and instantly seen while playing the game.
Pause allows the developer to pause the frame that the game is currently on. This can be helpful as this allows the game to still be running but stopped on the frame for easier debugging.
Step is used with the pause button as it allows the user to step through to the next frame. This also helps with debugging as each frame in a sequence can be slowly analyzed.
Cloud is the next button available at the top of the toolbar. While this may not be as useful when creating a game for the first time, it can be very helpful once a game is launched. This gives you access to the unity Services window which will display the analytics of your game. Such statistics being active users, retention rate, playing time etc…
Account drop down gives you access to your Unity Account tools that will also help in launching your game. This can allow you to set up In-App purchasing, implementing Ads or even setting up a multiplayer game.
Layers drop down will allow you to see what layer you are working on. Layers are helpful as they can determine how close something should be presented to the player. An example being a players health bar. This should be on one of the layers closest to the screen while the player should be on one of the lower layers.
Layout allows you to change how your current layout of the screen is set up. You can create your own layouts of the windows to make it easier when creating a game. There are some preset layouts that have focus on specific windows such as a split between the Game view and the Scene view. It is completely up to your personal preference.
Now that we have completed talked about the Toolbar at the top of the screen, we will move onto the next window.
The hierarchy is the window that contains a list of every single Game Object that is in the current scene. These assets are displayed in a test list format for easy scanning.
Hierarchy also allows the developer to group objects together by making a parent an a child of an object. This can be easily done by dragging and dropping an object on top of on another. The one that is being dropped will be the child. Children that have the same parent are considered “siblings” of each other. Unity also allows for nesting of children. This grouping can make it very efficient when creating bigger scenes with assets that need to be together and moved together at one time.
This view can make it easy for the developer to find an object as the Hierarchy and the Scene view are tied together. Selecting an object in one also selects the object in the other view.
The Scene View gives an interactive view into the scene that you are currently working on. It give a visual representation of what the game will look like once it is compiled.
The most common way to move around in the scene view is to hold down the right mouse button and then moved around with the W,A,S and D keys. The movement is similar to that of a FPS which makes it easy to learn. The toolbar options of Move, Rotate, Scale and RectTransform can be utilized when using this window. The benefit is that your adjustments are instantly updated and displayed in the window.
The Inspector Window is used to view and edit the properties and settings of Game Objects, assets and other [references in the settings editor.
The Inspector allows you to change the position, rotation and scale of an object within the scene manually. It also allows for the adjustment of the physical appearance of the object. The materials and textures can be changed by clicking the settings icon and locating to the desired material. The Inspector also allows the user to drag and drop the material they wish to use. Depending on the asset, there may be custom variables attached to it. An example being a camera object has specific attributes to it that can be modified. These attributes might not be found on a regular capsule object.
The Inspector also shows public variables of the scripts that are attached to the Game Object. When the game is running, these can be changed and viewed in real time in the Game View. This allows for fast prototyping and bug fixing. This can also make it easier for designers when it comes to balancing a game to ensure everything is smooth.
Since the Inspector is dependent on the Game Object that is selected in the Scene View or in the Hierarchy, the Inspector is constantly changing. A useful tip is to lock an asset that you need quick access to a lot. By opening multiple Inspector windows, this can make it easier to change multiple objects on the fly.
This view allows access to your library of assets that you are able to view and edit. Like the rest of Unity, this supports dragging and dropping functionality.
The left side of this window is the folder structure of the project in a list format. This is similar to the Microsoft Windows folder structure and is designed for easy visual navigation. On the right is what is currently in the folder that is selected on the left. There are visual representations of the asset as well as the name that the user has given it. Above the visual representation of the assets is the breadcrumb trail that will prevent the user from getting lost in the file structure.
Since projects can get quite large, there is a search bar at the top right of this window. You can also adjust in which folder you would like to focus your search. As always, there is a visual representation of the components within the directory. Notice how each component has a different visual representation in the example below.
While Unity may seem overwhelming at a first glance, you will see that each component is quite simple and has a purpose for being there. Each window and view works with one another in some aspect that it is important to get a good understanding of each one individually. The more comfortable you become with the windows and navigation, the easier it will be to prototype your ideas more efficiently. Take some time to read some more of the documentation or follow some tutorials on the UI.
Next we are going to use what we learned here and begin making our first scene. We will use some of the level editor tools as well as some other level design tools that will give us a good basis on how we can build something from nothing.