Notifications
Article
How to get started with game development in Unity and C#?
Updated 10 days ago
168
1
Start bringing your vision to life today. Unity’s real-time 3D development platform empowers you with all you need to create your games
This article is intended as a starting point for all aspiring game developers including those already with a background in programming but coming from another industries and willing to learn how to make games in Unity.

How I've started with Unity?

In 2012 I was already carving into many game/engine programming books, mostly using Java because it was already my main programming language in that time. In the end of that same year I was in a game development conference in Rio de Janeiro and I heard about Unity 3D for the very first time. When I got home that same evening, I entered Unity's website, downloaded the editor and started going through the documentation wanting to learn everything as fast as possible just to start seeing things happening on the screen.
For my surprise, C# was one of the possible programming languages to be used for scripting and I've chosen it as my favorite one on Unity since then. My transition to C# (as a Java programmer) was quite smooth, because both programming languages are based on C++ and they have a lot in common, including a great part of the sintax.
On the other hand, the documentation was huge (scary) and I knew I had a quite rough journey ahead and considering that I already had a fulltime job, it would need some dedication to really get to the point of learning it, as the only time I had was during the night (...and that's the story of how I stopped sleeping).
On that same week, I went to a local book store looking for some Unity books (as I prefer real/printed books) and I could not find any. So I decided to visit a website where people used to sell old books and that was basically when I found my first Unity book. The book was so horrible that I don't dare sharing its title here, but buying it was a great thing because it ended up leading me to my first freelance job with Unity. It turned out that the guy who sold me the book had a sort of "company" with his friend and they asked me if I was interested in jumping into a third party project with them, and of course I accepted it right away.

The awesome journey through the game dev jungle

Game development is an amazing beast... it takes a little while to be mastered, but once you start to become familiar with it, then it turns into a fascinating venture, maybe even becoming your fulltime job.
Although I've said before that this is an awesome journey, it's quite clear that making games is not an easy task. Many people fail along the way and even big companies keep failing even after decades publishing games. The good thing is that we can learn a lot during the process of making a game. Every situation will serve you as hands-on experience and everytime you face similar problems int the future, you'll already know the pitfalls and shortcuts to overcome your obstacles.
In the past, game development was even harder, both because it was a brand new area, and because the pioneers on the field were all experimenting and learning while commiting lots of mistakes and reinventing the wheel every single time a new game title was in development. In some point though, the game studios and software engineers started to standardize some of the concepts of game programming and they started to break the development process into smaller and well separated/defined sub-areas.
That's exactly when fully featured game engines come into play and what Unity is for us. It encapsulates the common and known problems that show up in every single game project, and it provides us with a powerful and reusable framework and editor that includes scripting, assets management, physics, collision detection, AI, UI, audio/graphics processing and every thing that's necessary for a game to be developed.

How to get started?

The short answer is: "visit the website https://unity.com/", but that's way too broad. Well, you should still visit the web site to download the editor anyways. It's recommended to use the Unity Hub because that way we can centralize multiple unity versions and keep the engine up to date. One of the best ways of getting started with Unity is by digging the documentation. It gets updated as a new versions of the engine roll out and it contains reference to two important parts: The Unity Manual and the Scripting API. While the Unity Manual is a complete guide to describe most of the features, sub-areas and how to(s) within the engine, the Scripting API, on the other hand, is a reference guide that contains details of the API that Unity provides, and it's where you can find namespaces and classes common to the platform. To use this information provided in the Scripting API document, you should be familiar with the basic theory and practice of scripting in Unity which is fully explained in the Scripting Section of the Unity Manual. You can also find some valuable information at Unity Learn, including projects, courses and tutorials.

The learning process

Unity is composed by multiple modules and it may be hard to learn everything at once, specially for complete beginners in game development. I strongly recommend to first learn about the building blocks of Unity before starting to get deeper into game programming.
I'm not covering everything that's already included in the documentation here, but this part is supposed to serve as a quick guide for beginners on Unity and probably on game programming, I'm assuming though that you have already a basis on object oriented programming, as I'm not showing what is polymorphism, inheritance, classes etc. In case you're also learning C#, you can go to Microsoft's Introduction to C# online guide for more details about the language. Below, are the areas I want to highlight on Unity, as they are essential to start making any simple game - The Editor, GameObjects, Components, Scripting, User Input/Controls, Collision Detection and Rendering:
The Editor
This is the first vision we have of the editor when we first open it. It's composed by 4 different areas initially and we can customize it the way we want. We can drag each of the windows to another part of the screen, we can enable or disable windows as well, and the good part is that the preferences will be saved, meaning that the next time you open the editor it will have all the windows setup the way you've customized before. You can find a helpful guide to the editor features here in case you want to keep reading about the other areas provided by the Unity engine. You can also find some great videos on how to start navigating the editor here and you can also read about The Main Windows.
  • Hierarchy: Enables nesting and structuring of GameObjects within the scene
  • Scene View: Allows placement and movement of GameObjects in the scene
  • Inspector: Provide details on the selected GameObject in the scene/hierarchy
  • Project/Assets: All scenes, prefabs, textures, models, scripts, audio files etc are stored here
To customize the Editor we can simply use the left button of the mouse to click on the window tabs (where the tab name is located) and drag that window around. We can use the "Hierarchy" tab as an example here:
In this example, I clicked the hierarchy window and dragged it all the way to the right to make it a child of the Inspector window:
In order to close one of the windows, we can click on its tab title with the right button of the mouse and select the option "Close Tab":
In case you had closed one of the internal windows and want to bring them back, you can go to Window > General and click the option you want to make it visible again. As you can see below, each of the default windows is also controlled by a shortcut using Ctrl on the keyboard:
To run our game in the editor, we should simply hit the play button located on the top of the editor screen, highlighted by the red circle below:

Game Objects
Basically, anything you place within a scene in Unity must be wrapped in a game object.
A GameObject is a representation of an entity in your game scenes and it's the most important concept in the Unity Editor. Note that GameObjects only exist inside of a scene within your game, they cannot be referenced in your project through the directories. They are metadata created in your scene file to keep reference on where an entity exists and how they should behave.
You can read more about GameObjects in the Unity Manual.
Game Objects may be a child of another Game Object (building up a hierarchy of objects), and they also may be composed by multiple Components and they will behave in accordance to all Components attached to it on the scene (we'll see more about Components soon).
There are different ways of creating Game Objects on the scenes as we can see below:
  • Create Option - The first way of creating a GameObject is through the Create option right below the Hierarchy tab name, as showing on the left frame above
  • Right Click on the Hierarchy Window - A second way is by right clicking inside the Hierarchy window and selecting Create Empty, as showing in the center of the image above
  • Menu Bar / GameObject - The third way of creating a Game Object is by clicking the "Game Object" menu item on the Manu Bar on the very top of the screen in the Editor
  • Keyboard Shortcut - As you can see on the Menu Bar option on the right frame above, it's also possible to hit Ctrl + Shift + N to create a new GameObject on the scene
When a GameObject is first created it comes the world (I mean to the scene) almost totally empty, except for the Transform that is automatically attached to the object during the creation, for the simple fact that in order to have an existing object on the scene, it should ocupy a location in the space, and the Transform is exactly the Component responsible for the position vector for the object in the world.
As a simple example, let's imagine that we're working on a soccer game where we must have the players (characters), the stadium, the ball and some people in the crowd. All those entities will be a GameObject, and some of them will probably be a child of another GameObject, like the crowd for example, it may be set as a child object inside the stadium, but at the same time it may contain multiple objects referencing a person.
We'll see how to access some of the most important members (fields, properties and methods) of a gameObject on the Scripting part soon, including the Transform Component.
Components
A Component is basically everything that can be attached to a GameObject to provide it with new "abilities" in runtime. You can find more details about the Component in the Scripting API and you can read more about Components in the Unity Manual too. If you would like to understand a bit more about the core behind Components in Unity, you should also check the Entity Component System (ECS) pattern and it's flexibility here.
Every kind of features that we can imagine for a gameObject is a Component, and that includes rendering features, UI layouts, physics, materials, meshes, AI, animation/animators, interaction events, scripts and whatever more you can bring to your mind, it's probably a component.
To add a component to an object in the scene, we should first select that object directly from the Scene View or by clicking on it through the Hierarchy window. Once the object is selected, we'll be able to see it's details through the Inspector window and also, if we scroll down all the way to the bottom of the Inspector, we'll be able to see the Add Component button.
In this example above, the selected object is the Main Camera, and after clicking the Add Component button, we'll be able to scroll through the list of available components:
Scripting
In every game project, it's quite possible that we'll need to control the behaviour of our GameObjects on the scene, and in order to achieve that, we'll need to create scripts that are basically code parts referencing the objects and their components. From within the script lines, we're able to access the camera, specific objects created for the games, light, UI elements etc. Scripting is a powerful way of manipulating the interaction with our game entities and make them behave the way we need them to. To have a complete overview about scripting inside Unity, we can read in details the Scripting Section on the Unity Manual.
Unlike most other assets (that are generally created in thirdparty softwares), scripts are usually created within Unity directly. You can create a new script from the Create menu at the top left of the Project panel or by selecting Assets > Create > C# Script from the menu bar (on the top of the screen in the Editor).
The new script will be created in whichever folder you have selected in the Project panel. The new script file’s name will be selected, prompting you to enter a new name.
When you double-click a script Asset in Unity, it will be opened in a text editor. By default, Unity will use Visual Studio, but you can select any editor you like from the External Tools panel in Unity’s preferences (go to Unity > Preferences).
The initial contents of the file will look something like this:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleClass : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
You can see that your script automatically extends MonoBehaviour, and MonoBehaviour, in turn, extends Behaviour, that extends Component. That's exactly why we can attach the script to a GameObject, because on it's core, it's also a Component.
From the MonoBehaviour scope, it's possible to access the gameObject reference to which this new script is attached to. And in order to do that we can simply call gameObject from within the script. Let's, for example, how to enable the object when the game starts:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleClass : MonoBehaviour { void Start () { gameObject.SetActive(true); } void Update () { } }
Simple, right? So, from your code editor if you type "gameObject." (the [dot] in the end was intentional) and after that you press ctrl + space on your keyboard, then you'll be able to see the reference list for all accessible members on the gameObject. We can see the example below using Visual Studio:
As a second example we can talk about the transform Component. If you take a look again at the image above, you'll see that the "transform" is also included in that list. That's because we can access the transform and apply transformations to that gameObject.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleClass : MonoBehaviour { void Start () { // Moving the object to x=10, e z=10, note that y=0 gameObject.transform.position = new Vector3(10, 0, 10); // Setting the rotation to have the same value as Quaternion.identity gameObject.transform.rotation = Quaternion.identity; // Scaling the object by 2 in x, y and z gameObject.transform.localScale *= 2; } void Update () { } }
Note that all those transformations are happening when the game starts, as they're executed inside the "Start" method.
If you want to understand a little bit more about the methods extended from MonoBehaviour and their respective execution order, you can take a look on ExecutionOrder in the Unity Manual.
As I'm mentioning the execution order, I believe it's important to understand what happens in a game engine, in the backgrounds while a game is running. So, first of all, video games generally run inside of a loop, which keeps running while the application is up or the device is active (or turned on in some cases). With that said, it's really important to avoid adding loops (while, for, foreach, do while etc) and heavy processes inside the Update method of a MonoBehaviour script. Because as you can see in the representation below, the Update is called on each frame (iteration in the example):
using System.Collections.Generic; public class UnityCore { public static void Main() { bool isGameRunning = true; if(isGameRunning) { // List of all monoBehaviours in our scene List<MonoBehaviour> monoBehaviours = new List<MonoBehaviour>(); // As the process starts, it runs the start for all objects before entering the loop // It also runs another initialization code for these objects foreach(MonoBehaviour mb in monoBehaviours) { mb.Start(); } // This loop keeps calling the Update for each monoBehaviour in the scene // for as long as the game is running while(isGameRunning) { foreach(MonoBehaviour mb in monoBehaviours) { mb.Update(); } } } } }
The code snippet above is only a simple representation of what happens on Unity when we run the game, it's not a legit code extracted from the Unity core. There are way more processes happening in a real engine in runtime.
As mentioned in some point above, it's also possible to access another Components attached to a gameObject, and to do so, we can use a member method from GameObject called GetComponent, passing the generic type of the Component we're intending to retrieve.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleClass : MonoBehaviour { void Start () { // In this case we're trying to get a valid Sprite component from the gameObject // assigning it to a local sprite reference Sprite sprite = gameObject.GetComponent<Sprite>(); } void Update () { // It would be a bad idea to use the code above here, as mentioned before, // it would be called continuously } }
Another useful feature to know about, still in the fields of scripting, is how to access objects' fields through the Inspector Window in the editor. There are two common ways of making fields visible while inspecting a GameObject, the first one is by using the accessibility modifier public on a field we want to show, or by using the the C# Attribute SerializeField from the package UnityEngine. Note that SerializeField will make both private and protected fields visible in the inspector:
using UnityEngine; public class Character : MonoBehaviour { public int life; [SerializeField] private int speed; [SerializeField] protected int strength; }
As we can see, we've created a GameObject called Character in this case, and we've attached the Character script to it, making some fields accessible through the inspector on it. By selecting the given GameObject through the Hierarchy Window we can see it's stats showing up on the Inspector Window, and we can modify those values so that they'll be reflected in runtime when we hit play.

User Input/Controls
Input and controls in general are widly used in any kind of games. Now that we've seen already how a MonoBehaviour script works, we can see how to control input within the script. There are different ways of implementing Input controls in Unity, but the most common one is achieved by tracking the inputs on the Update method, you can check the Scripting Reference to obtain more details. By this time in 2019, Unity is also introducing the new input system, and you can understand more how it works here.
Also, it's important to mention that there are some differences on the Input Controls from platform to platform.
Let's take a look on how it works for tracking buttons, for example:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleClass : MonoBehaviour { void Start () { } void Update () { // Mouse controls on button pressed, use this ones when you are wanting to do something everytime the // a mouse button is pressed if (Input.GetMouseButtonDown(0)) { // Do something when the left button of the mouse is pressed } if (Input.GetMouseButtonDown(1)) { // Do something when the right button of the mouse is pressed } if (Input.GetMouseButtonDown(2)) { // Do something when the wheel of the mouse is pressed } // Mouse controls on button released, use this ones when you are wanting to do something everytime the // a mouse button is released if (Input.GetMouseButtonUp(0)) { // Do something when the left button of the mouse is released } if (Input.GetMouseButtonUp(1)) { // Do something when the right button of the mouse is released } if (Input.GetMouseButtonUp(2)) { // Do something when the wheel of the mouse is released } // Keyboard controls - uses the Enum KeyCode, which has a value for each of the common keys on a keyboard if (Input.GetKeyDown(KeyCode.A)) { // Do something when the A key is pressed on the keyboard } if (Input.GetKeyDown(KeyCode.Space)) { // Do something when the SPACE key is pressed on the keyboard } if (Input.GetKeyUp(KeyCode.A)) { // Do something when the A key is released on the keyboard } if (Input.GetKeyUp(KeyCode.Space)) { // Do something when the SPACE key is released on the keyboard } } }
When it comes to track movements in vertical and horizontal, be it with the keyboard, mouse or joysticks, that can be achieved by using Input.GetAxis, we can also see the pre-defined list of axisNames in the editor through the Menu Bar on Edit > Project Settings > Input:
From the coding side, what we should do to use Input.GetAxis is:
using UnityEngine; using System.Collections; // A very simplistic car driving on the x-z plane. public class ExampleClass : MonoBehaviour { public float speed = 10.0f; public float rotationSpeed = 100.0f; void Start() { } void Update() { // Get the horizontal and vertical axis. // By default they are mapped to the arrow keys. // The value is in the range -1 to 1 float translation = Input.GetAxis("Vertical") * speed; float rotation = Input.GetAxis("Horizontal") * rotationSpeed; // Make it move 10 meters per second instead of 10 meters per frame... translation *= Time.deltaTime; rotation *= Time.deltaTime; // Note that we can access the transform component directly without using the gameObject reference // Move translation along the object's z-axis transform.Translate(0, 0, translation); // Rotate around our y-axis transform.Rotate(0, rotation, 0); } }
When it comes to track the input axis for mouse movements, it's slightly diferent:
using UnityEngine; using System.Collections; // Performs a mouse look. public class ExampleClass : MonoBehaviour { float horizontalSpeed = 2.0f; float verticalSpeed = 2.0f; void Start() { } void Update() { // Get the mouse delta. This is not in the range -1...1 float h = horizontalSpeed * Input.GetAxis("Mouse X"); float v = verticalSpeed * Input.GetAxis("Mouse Y"); transform.Rotate(v, h, 0); } }
For mobile input controls, instead of using axis or buttons, we'll normally track the touch index for each of the fingers touching the screen and do something for a given situation. The UI elements already respond to touch, so we don't need to manually handle that for mobile and other platforms, Unity takes care of that already with events.
Each touch event has an index starting from 0 that can be retrieved by using Input.GetTouch( ...the touch index goes here ), so for example, if we want to get the very first touch that happens on our screen, we should pass the index 0, Input.GetTouch(0) in this case, and it returns an instance of the Touch struct. You can read more about Input.GetTouch here. The touch object is controlled by phases, which are basically states.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleClass : MonoBehaviour { void Start () { } void Update () { if (Input.GetTouch(0).phase == TouchPhase.Began) { // Do Something when the touch 0 has started } if (Input.GetTouch(0).phase == TouchPhase.Canceled) { // Do Something when the touch 0 has been canceled by the system } if (Input.GetTouch(0).phase == TouchPhase.Ended) { // Do Something when the touch 0 has finished, finger was lifted } if (Input.GetTouch(0).phase == TouchPhase.Moved) { // Do Something when the touch 0 moves to a different point of the screen than it was previously } if (Input.GetTouch(0).phase == TouchPhase.Stationary) { // Do Something when the touch 0 keeps stationary } } }
Touch Phases:
  • Began - A finger touched the screen
  • Moved - A finger moved on the screen
  • Stationary - A finger is touching the screen but hasn't moved
  • Ended - A finger was lifted from the screen. This is the final phase of a touch
  • Canceled - The system cancelled tracking for the touch

Collision Detection
Another important feature to implement in our games is collision detection. Being able to test whether or not an object is intersecting another is really useful and I don't remember playing any game that wasn't using it in some point. If you think about platform games where we keep jumping through platforms and collecting some items, both features are detecting collision, to make sure that the character will stand on top of the platforms and while collecting items we should generally make some triggering event happen, maybe increse the score total, for example. The possibilities are endless with colliders.
Now that we already know about Components and Scripting we're ready to use Colliders in our games. I'm mentioning both, because first, a Collider is a Component and in order to control collisions in our game, we'll need to override other methods from MonoBehaviour, other than the default Start and Update defined automatically when we create a new script in our project. You can see all the methods present in the MonoBehaviour class here.
There are many different colliders in Unity and also there are some colliders specific for 2D or 3D objects, and a third thing that's also important to say is that colliders can be mere triggers instead of causing physical collision between objects. Triggers are colliders without the physical aspect, they are only used to track area, for example to implement area of sight, area FXs etc.
To add a 2D collider to a gameObject, we should hit the Add Component button through the object's inspector and next we should click the option Physics 2D:
To add a 3D collider to a gameObject, on the other hand, we should also hit the Add Component button through the object's inspector and next we should click the option Physics:
After adding a collider to our object, we'll be able to see the collider's stats through the object's inspector as well, in this scenario we decided to include the BoxCollider2D as showing below:
Note that this BoxCollider2D is marked as IsTrigger, and that's how we set it's behaviour to not include physics collision while intersecting another object.
Remember to add a RigidBody2D to at least one of your objects intended to collide with another objects, otherwise the collision detection methods will never be called. We'll be using RigidBody2D in this case, because we decided to add a BoxCollider2D, if it was a BoxCollider instead, we'd need a RigidBody from the Physics not from Physics2D:
Remember to set your gravity scale to 0 in your RigidBody2D stats (as in the picture above) if you don't want to have your object falling down due to the influence of gravity in the world.
We're only able to detect collision between objects, if our objects have a Collider Component attached to them and as I've mentioned above, at least one of them also should have a RigidBody/RigidBody2D attached it depending on the type of collider used. Once we have colliders attached to our objects in the scene, we'll be able override successfully any of the collision detection methods from MonoBehaviour, of course we can still override those methods even if out object doesn't have a collider, however, our collision detection methods will never be called by the system.
OnCollision methods are only called by the system for colliders not marked as IsTrigger, while the OnTrigger methods are only called for colliders marked as IsTrigger:
OnCollisionEnter - OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnCollisionEnter(Collision collision) { // Handle collision here when the 3d object hits another 3d object } }
OnCollisionEnter2D - Sent when an incoming collider makes contact with this object's collider (2D physics only).
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnCollisionEnter2D(Collision2D other) { // Handle collision here when the 2d object hits another 2d object } }
OnCollisionExit - OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnCollisionExit(Collision other) { // Handle collision here when the 3d object stops colliding with the other 3d object } }
OnCollisionExit2D - Sent when a collider on another object stops touching this object's collider (2D physics only).
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnCollisionExit2D(Collision2D other) { // Handle collision here when the 2d object stops colliding with the other 2d object } }
OnCollisionStay - Is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnCollisionStay(Collision other) { // Handle collision here while the 3d object keeps touching the other 3d object } }
OnCollisionStay2D - Sent each frame where a collider on another object is touching this object's collider (2D physics only).
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnCollisionStay2D(Collision2D other) { // Handle collision here while the 2d object keeps touching the other 2d object } }
OnTriggerEnter - OnTriggerEnter is called when the GameObject collides with another GameObject.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerEnter(Collider other) { // Handle trigger here when the 3d object hits another 3d object } }
OnTriggerEnter2D - Sent when another object enters a trigger collider attached to this object (2D physics only).
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerEnter2D(Collider2D other) { // Handle trigger here when the 2d object hits another 2d object } }
OnTriggerExit - OnTriggerExit is called when the Collider other has stopped touching the trigger.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerExit(Collider other) { // Handle trigger here when the 3d object stops touching the other 3d object } }
OnTriggerExit2D - Sent when another object leaves a trigger collider attached to this object (2D physics only).
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerExit2D(Collider2D other) { // Handle trigger here when the 2d object stops touching the other 2d object } }
OnTriggerStay - OnTriggerStay is called once per physics update for every Collider other that is touching the trigger.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerStay(Collider other) { // Handle trigger here while the 3d object keeps touching the other 3d object } }
OnTriggerStay2D - Sent each frame where another object is within a trigger collider attached to this object (2D physics only).
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerStay2D(Collider2D other) { // Handle trigger here while the 2d object keeps touching the other 2d object } }

Rendering and Graphics
Rendering or image synthesis is the automatic process of generating a image from a 2D or 3D model (or models in what collectively could be called a scene file) by means of computer programs. Also, the results of displaying such a model can be called a render. In Unity, as you can see on your scene, when we create a GameObject we cannot see anything rendered on the screen when we hit the play button. That may happen for two common reasons:
  1. Your object doesn't have a Renderer Component
  2. If your object has already a Renderer Component, probably the renderer doesn't have a reference to a mesh or sprite/image
Unity doesn't generate meshes or images naturally, so those assets need to be created on external softwares and then exported to be added to the Unity Project. Another option, is to visit the Asset Store and download some images/3D models from there. To access the Asset Store from within the Unity Editor just press the command ctrl + 9, or go to Window > General > Asset Store from the menu bar.
You can find some useful information about Graphics on the Unity Manual including Shaders.
In order to make our GameObject renderable on the scene, we should make sure that it has a Renderer Component. If the the GameObject is supposed to represent a 3D object, it should have a Mesh Renderer with a Mesh Filter or a Skinned Mesh Renderer, but if the GameObject will actually hold a Sprite, then we need to attach a Sprite Renderer to it.
We can also find some great tutorials about 2d games and 3d games on the website.

Some other important areas in Game Development

UI Tutorials - How to set and use the UGUI to create the User Graphis Interface in your games
Audio Tutorials - How to set and control Audio Clips, Audio Source and Audio Listeners
Animation Tutorials - How to control Animations and Animators while manipulating rigged 3d models
Navmesh Tutorials - How to define Navigation and Pathfinding, control NPC logic and behavior in the game
Services Tutorials - How to set Ads, In-App Purchasing, Analytics and the Unity Cloud Build

Some literature and courses

Learn C# in One Day and Learn it Well - Although it has quite a misleading title, this is a great book to start learning the C# language and the Object Oriented programming concepts and practices. (Best for beginners)
C# in Depth - Jon Skeet is famous for his contributions to the StackOverflow community. C# in Depth was first published in 2008, the fourth edition is available to purchase (2019).
C# Smorgasbord - Filip Ekberg covers a vast variety of different technologies, patterns and best practices that any C# developer should master.
Udemy Courses: C# Beginners, C# Intermediate and C# Advanced and there are many other courses available there
Unity Courses: Getting Started with Unity - Completely new to Unity and looking to create your own 2D and 3D video games?

Other recommended books for programmers (Best Practices)

Clean Code - Best agile practices of cleaning code “on the fly” that will instill within you the values of a software craftsman and make you a better programmer.
The Clean Coder - Robert C. Martin introduces the disciplines, techniques, tools, and practices of true software craftsmanship. This book is packed with practical advice–about everything from estimating and coding to refactoring and testing.
Clean Architecture - Uncle Bob presents the universal rules of software architecture that will help you dramatically improve developer productivity throughout the life of any software system.
The Pragmatic Programmer - Cuts through the increasing specialization and technicalities of modern software development to examine the core process--taking a requirement and producing working, maintainable code that delights its users
Game Design Patterns - The biggest challenge facing many game programmers is completing their game. Most game projects fizzle out, overwhelmed by the complexity of their own code. Game Programming Patterns tackles that exact problem ( also available on the website in digital version )

Conclusion

As we could see, Unity is quite an extensive engine, full of features and at first it may seem hard to learn. It's true, it's not an easy task, but if we follow up the principle of understanding the building blocks - how GameObjects work, how the script is executed and how to find in the documentation a given topic of our interest, then we'll be in good shape to keep progressing within the engine.
There are so many topics I did not cover in this article, but it was intentional as they might be overwhelming for beginners, and they'd easily cover an article alone to talk about them in details. AI, Physics, Networking and UI are great examples of that.
Keep the hard work and you'll see great results soon. Within about a month you'll become so confident with the basics that all those subjects will be accomplished without even thinking.
Rodrigo Abreu
Software Engineer at EA / Unity Live Expert - Programmer
12
Comments
GP
Nice introduction to Unity :)
1