Learning C# by Developing Games with Unity 3D Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Chapter 2. Introducing the Building Blocks for Unity Scripts

A programming language such as C# can appear to be very complicated at first but in reality, there are two parts that form its foundation. These parts are variables and methods. Therefore, understanding these critical parts is a prerequisite for learning any of the other features of C#. Being as critical as they are, they are very simple concepts to understand. Using these variable and method foundation pieces, we'll be introduced to the C# building blocks used to create Unity scripts.

For those people who get sweaty palms just thinking of the word script, wipe your hands and relax. In this chapter, I'm going to use terms that are already familiar to you to introduce the building blocks of programming. The following are the concepts introduced in this chapter:

  • Using variables in a script
  • Using methods in a script
  • The class which is a container for variables and methods
  • Turning a script into a Component
  • Components communicating using the Dot Syntax

Let's have a look at these primary concepts.