The “action” part of programming comes from “calling” (also known as “invoking”) something called a “method” (also known as a “function”). In this lesson we will learn how to define and call our own methods, and then review a few more which are special to Unity. Finally, we will create our own “Magic 8 Ball” demo and cover how to link a method to the click of a button, and drive the output of a label. Continue reading


If I were data modeled by a computer, there would be variables which describe me including one to reference my name (a value which hasn’t changed) and my age (a value which does change every year). Some variables could only be determined by me, such as the name of my favorite movie, and others might be controlled in whole or in part by external sources, such as my marital status. All of these kinds of relationships can be modeled in code when you know the right vocabulary. In this lesson, we will create a class which implements the example I just provided, and then we will use our understanding of variables to animate an example solar system, all with a single easy script. Continue reading

Your First Script

If you’ve never created a script before, don’t worry, it’s not exactly rocket science.  Learning to program is like learning a new language, but you are “talking” to the computer.  Just like a human language can be broken down into sentences which consist of a noun and a verb, programming languages can be broken down into variables (the noun) and methods (the verb) which are often paired in statements (the sentence).  Learning to program simply requires a bit of effort to learn the vocabulary and then to put it all together in a logical way. Continue reading

Learn C#

This tutorial series is designed for a quick introduction to programming in C# using Unity. It will briefly introduce most of the language features, but from the perspective of use within Unity rather than general use cases, and hopefully therefore will be more interesting to learn from. I will be writing with the assumption that you already have Unity and have a basic understanding of the program. Continue reading

Dynamic Animation Part 1

Unity has some pretty decent animation abilities built into the engine with which you can keyframe the position of entire hierarchies of objects. If you were animating a walk cycle or a bouncing ball, it works great. Other common use cases, like animating the move of a UI element when supporting multiple screen aspect ratios, are another issue. When you don’t know what the size of your screen will be, you can’t keyframe an animation for it. There are plenty of plugins on the asset store which solve this problem, but if you are like me and want to know how it all works, or you simply don’t want to spend money, read along and we will create our own solution. Continue reading