This set of C# coding tutorials is for you if you are completely new to programming or the C# language. You will learn all you need to know to code C# games as quickly as possible. You could be tinkering with your own game projects within a few hours.

There are plenty of game-related mini-projects in Unity to accompany this course and I would recommend you complete them all. Firstly because you will learn better by actually coding and secondly because the projects are the most fun.
[widgets_on_pages id=”udemy_advert_unity_1″][widgets_on_pages id=”udemy_code_details”]

About this tutorial

Skill level 1
Time to read: 10 minutes

New Concepts:

  1. C# code comments
  2. Introduction to the top C# topics especially for building games

Recommended preparation tutorials

  • No previous experience needed

Projects related to or that demonstrate these concepts

C# can be used to program almost any type of application. Its primary use in the context of this website is for Unity games. Although Unity has other language options, C# is recommended by Unity, is the most robust option and will possibly be the only option in the future. A thorough knowledge of c# is essential if you want to make games for Windows, Mac, Linux, Android or IOS, using Unity.

This C# course will assume you know absolutely nothing about C# or any other programming language. It will explain all jargon as we proceed through each tutorial.
At times in the course, we will take a break from theory to do an appropriate project. These projects are hands-on real coding and are much more fun than theory.

Explaining code through comments

Sometimes I will add extra explanation or clarification within the code itself. To do this I will use C# comments. Whenever you see a line of code with two forward slashes- like this // at the start, that line of code doesn’t do anything, except tell you something about the code. In our C# programs, we will use comments to remind us of what different blocks or lines of code achieve. Here is what a comment looks like.

// I am just a comment and don't really do anything


// The line of code above shoots at the player
// That was a useful comment, wasn't it?

Enough of all the introductions let’s get on with the tutorials.
[widgets_on_pages id=”udemy_advert_games_category”][widgets_on_pages id=”udemy_code_details”]

The C# game coding tutorials

The tutorials are designed to get you coding games as fast as possible. They are not fully comprehensive and some topics are presented with the barest possible information. The reason for this is that the best way of learning to code C# games; is to code C# games. The sooner we can start doing that the better. You will find that all of the practical C#/Unity projects on this site come with loads of refresher and additional information.

• Don’t feel you need to master a topic before moving on. You can always refer back
• Do expect to from time to time to expand on topics, perhaps with a Web search, if you want to master a topic

Here are the C# tutorials.

1 – Game data and variables in C#

This tutorial introduces the fundamental C# building blocks of our game, variables. The variables tutorial explains how we keep track of the state of our game when writing in C#. Variables can be everything from the player’s score to a playable character or the design of a whole world. Let’s get started and learn about game data and variables in C#.

2 – Making use of Game Variables in C#

This tutorial shows us the mathematical way in C# that we can change our game’s data that is contained within our variables. After all, the player’s score does not remain at zero forever. Making use of game variables in C#.

3 – Conditions and decisions in C#

Now that we can use variables to represent all the vital data in our game we will see how we can test for important events called conditions, within our game. How do we know when the player has got a high-score or fallen into a pit of fire? Find out about Conditions and decisions in C#.

At this point, you are ready for your first Unity project which uses Unity to explore the c# concepts we have learned so far. Unity and C# project: Part 1

4 – Looping our game code

In game coding, we will regularly want to execute parts of our code multiple times while making subtle or not-so-subtle variations to our C# code on each pass. For example, each and every frame of our game is contained in just such a loop. This is how it works: Loops in C#.

5 – Organizing code with methods

Methods are the organizing blocks of our code. We can think of a method as a black box that does one very specific task and can be reused over and over. Learn how we Structure C# games with methods.

At this point, you are ready for your second Unity project which uses Unity to explore the C# concepts of looping and methods. Unity and C#  part 2.

6 – Introducing OOP for C# games

OOP is probably the most vital topic in modern game coding. How do we break down our planned game and the objects (like characters, spaceships, and levels) into its most appropriate constituent parts? Find out in this introduction to OOP. Object oriented programming in C#.

At this point, you are ready to dive into the rest of the Unity projects which actually start to resemble real games, in order. Eventually, you will build your first fully working game in Unity using C#.