Lesson 8 – Awake() & Start()

You may have noticed that there is a common element living in the beginning of most of our C# scripts within Unity. Mostly you may have noticed the Start() Method living close to the beginning of your class script. This rhythm is by design, and it is one of many built-in Unity Methods provided to us by the Monobehavior class.

So, what do they do?

I want you to think of Start() and Awake() as the beginning to a good book. You can not have a middle or end without the beginning laying down a solid foundation of characters/settings to work with. The same can be said about the Start() and Awake() methods.

Continue reading “Lesson 8 – Awake() & Start()”


Lesson 7: Scope and Access Modifiers

From this lesson moving forward, we’re going to be speaking of C# scripting in a way that more relates to its functions within Unity. Scope and Access Modifiers is a fantastic place to begin.

Before we begin, let’s set our state of mind to the following:
When you are writing scripts for your game, whether it be behavior scripts for character movement, physics, or shooting a gun, we can safely say that it will be necessary for these systems to interact.

What is a Scope?

The scope of a variable is the area in the code in which the variable can be used in. A variable is local to the place in code that it can be used. Code blocks are generally the area that defines where the code can be used, and they are denoted by braces/brackets {}.

Examples of Scope:

Continue reading “Lesson 7: Scope and Access Modifiers”

Lesson 6: Loops

Like Variables, Functions, and Conditional statements mentioned in our previous lesson, it’s best to get familiar with programming Loops — boy-oh-boy will you need loops in your game developing future.

What are Loop statements?
Simply put, Loop statements are ways for you to execute a block of code {} multiple times. If you need something repeated a specific number of times — or an infinite amount of times, it can be written in the code by you!

Why would I use Loops in Game Development?

Please allow me to speak very loosely here. You would use Loops in Game Development if you wanted to repeat an action/behavior multiple times. Maybe you want the animation of a cloud persistently moving left through the x-axis, in which case you create an infinite loop to make it so. Or maybe you want to loop the act of a machine gun shooting until it runs out of ammo, in which case you loop the action until a condition is met (ammo == 0).

Please Note: In my experience, once a condition is met within a loop, the block of code no longer get’s repeated, and the loop is terminated.

Continue reading “Lesson 6: Loops”

Lesson 5: IF Statements

IF Statements! The bread and butter of Unity. The piece de-resistance. Where all the magic happens. Well, some of the magic. Let’s dabble a little on what IF statements are, and how they get used within Unity.

An IF statement is a part of a family of statements that we call conditional statements. This means that you use it to have your code make a decision based on a defined condition. Let’s use a video game example: You love collecting coins in Super Mario Bros. Even better is the fact that you get one extra life by collecting coins, but only IF you reach a total of 100 coins:

private int coins = 0;
private int life = 1;

if (coins == 100)
    life +1; coins = 0

Got it yet?

Continue reading “Lesson 5: IF Statements”

Lesson 4: C# vs. JS

Notice: From this point on I will be referring to the language C Sharp as C# and the language JavaScript as JS.

Why is this topic even important? Well, it is and it isn’t. It’s important because Unity3D currently supports C#, JS (and boo… more on that later…or never, actually.. yeah never), so it’s healthy to understand the very basics in regards to the differences between these two languages. It isn’t important because if you are a beginner like me, the most important thing for you to do is to grab a language and learn, learn, learn!

REGARDLESS, Let’s talk about some basic differences in the syntax and behavior of C# vs. JS.



In C#, scripts are made up of one or more class/classes. You would write your script within this defined class.

public class ExampleSyntax : MonoBehaviour
{  //<---- Notice that all the code is written inside of the class.
    int myInt = 5;

    int MyFunction (int number)
        int ret = myInt * number;
        return ret;
} //<---- Notice that all the code is written inside of the class.

Continue reading “Lesson 4: C# vs. JS”