In this article series, you will be learning the fundamentals of the C# programming language. In the last article, you printed a simple message to the Console. For all subsequent articles, you’ll be printing text to the screen.

This is a great way to see your code in action as well as get used to working with the Unity editor itself. This does pose of complexity problem. You will be writing code that is beyond your skill knowledge. In this article, you’re going to set everything up.

I ask that you “follow along”. Don’t try to understand every single thing. You need to “level up” in order to understand some of the core concepts. Just have faith that at some point, you will understand both the code and Unity interface. Through gradual practice, everything you do will become clear. Just be patient

Understand the Unity Editor

Before playing around with code, you should have a basic understanding of Unity itself. That way, you won’t be wrestling too much with the interface while learning code.

When you first look at the interface, it may seem overwhelming. It looks like a lot of information and it is, but you are looking at several views that provide different information about your game. These views are fully customizable. They can be dragged and docked, creating new layouts.

Here you can see all the views highlighted and numbered in the Unity editor. Here’s the current breakdown.

1 – Hierarchy Window

This is the Hierarchy window. The Hierarchy contains all the objects in your game scene (you’ll learn about game scenes in the next bullet points). These objects – also known as GameObjects – can be things like the camera, the player, enemies, bullets being fired, torches in the background – anything that appears on the screen.

GameObjects act as folders so you can drag GameObject inside of other GameObjects. This becomes especially useful when organizing all your scene data. This is beyond the scope of this article series.

2 – Scene View

Everything in your game scene lives in this view. A game scene can be a single level in your game. Or your entire game can live in a single scene. You decide the organization.

For example, in one iOS game I produced, I had the cut scenes in one scene, and the actual gameplay in another scene. I could have kept everything in one scene, but I wanted to keep the clean division.

To navigate the scene view, mouse over the view and press right-click to look around. To move, hold the right mouse button and use the WASD keys to move. Hold the shift button to move extra fast.

3 – Project View

The project view lists all the files in your entire game. This includes models, sounds, scripts, animations, and many more. This organization matches your file system so you can create folders and organize your files however you like.

Best Practice: Use Unity to add and delete items to your project. Don’t use Windows Explorer or Finder to add files. Unity keeps an internal database of all the assets in your project. Deleting them outside of Unity may cause potential issues.

4 – Inspector

The inspector lists all the GameObject’s properties. These properties are contained in components. For instance, the default Directional Light in your scene contains two components: a Transform and a Light.

As you can see, each component contains lots of different properties. As you’ll discover, some GameObjects contain multitudes of different components. Later, you’ll even design your own.

One key thing to note: every GameObject comes with a Transform component. This component provides the GameObject’s location, rotation, and scaling in 3D space.

Other Views

Unity contains a whole lot of other views designed for specific tasks. For example, there is an Animation view to create custom animations inside Unity. There’s a Console view for reading messages produced by code.

The Game view is one of the more important views. This allows you to play your game inside of the editor. You can see it as a tab next to the scene view. Just click this tab to start viewing the Game view.

To test your game, press the play button in the top center of the Unity editor. Believe it or not, you can make changes to your game as you play it. This provides a way to test things on the fly without having to switch back to the editor. Just keep in mind that any changes made while playing the game will be undone when you stop playing the game.

There are ways to persist the changes, but that is beyond the scope of this article series.

Unity layouts

In Unity, a collection of views is called a layout. When you start Unity, you will be presented with the Default layout. Unity contains several other layouts. In the upper right-hand corner, you’ll see the Layout dropdown.

Click it, you’ll see all sorts of different layouts. I prefer the 2 by 3 layout as I can see both the Scene view and Game View in one glance.

In the Window menu at the bottom of the dropdown, you’ll see all the views available to you. Once you add views and reconfigure them, you can save your layout from the Layout dropdown.

This allows you to create task-based layouts. For instance, you may want to configure the layout to just contain views necessary for animation. This may include the Scene view, the Animation view, and the Animator view. For coding, you may just have the Scene view, the Inspector, the Hierarchy, and the Console.

For this article series, I’ll be using the 2 by 3 layout. The Unity interface can be a little overwhelming a first. If you have a specific question, definitely check out the official documentation.

Where to go from here

The Unity interface can be overwhelming when you first look at it. Thankfully, you can customize it to whatever works best for you. For instance, if you find the interface is presenting too much information, you can customize it to only show the information you need at the current time.

The “right” interface layout is the layout that helps you with a particular task or best works for your workflow.

In the next article, you’ll configure the scene that you’ll use to learn C#.

By Brian Moakley

Brian Douglas Moakley is a writer and technologist who lives amongst the quiet hills in New England. When not reading tales of high adventure, he is often telling such stories to all who will listen.

Related Post

Leave a Reply