Al Heck

Sign in

Events, actions, enable, disable, lots of stuff going on here. How can we simplify this a little and get to basics. Let’s start by creating a capsule and do a simple movement system. I’m going to create a player capsule and add simple controls the old way.


Both can be set up similarly, but instead of public/protected, we want to use static in declaring the constructor.

Also, static will always run first vs the regular public variables.


Utility helpers are static classes that can’t inherit but can be accessed anywhere. They can be both variables and methods inside this class.

The only difference from regular classes is all methods/variables need to be declared static.


An instance member is created during the application. The static member is a value that is automatically created and stored throughout the life of the program. Let’s start by creating a class.

Now let’s add a static value.


Static information is “stuck” information held for the life of the program. In this program, there are 2 scripts — a script where if I press the space bar, I add 10 to score and I have a score manager that has the score value attached to it.


Structs are almost exactly the same except they don’t do inheritance. So we can’t create sub-categories inside a struct like we could a class.

Structs are a value type — value types are stored on the stack

int age = 25; — this is a value type, the value is stored directly in this line.

bool type = true; this is a value type

string name = “name” ;— this is a value type

You can change the original value of this.

Class are a reference type — reference types are stored on the heap

string myName = “Jonathan”; — this is stored into memory on a certain address on RAM.

You cannot change the original value type — only create a copy


How can I get a script to override a class with a function? Let’s start with a main script of pets.

Now let’s create a Duck script. We want to change the speak from “speak” to “quack quack”. How do we do this? We change the function to virtual!


Let’s create a banking system. First, let’s define the bank with the proper variables that all banks share.

We want to do 3 functions — check balance, withdrawl, and deposits. Next, let’s create a bank and define it’s role.


We can have classes that inherit the information of other classes. To start, let’s create an item class.

Once this is created, let’s create a weapons class. In order to inherit the Item class, we need to replace monobehavior with the Item class.


Let’s create a class for a spell casting system. First, let’s create the class.

Now lets create a series of spells for our wizard by creating our wizard C# script.

Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store