Previous Lecture Complete and continue  

  Introduction

When you are using scripting in Unity, you are communicating with the Game Engine and asking it to perform actions. To communicate with the system, you are using a language or a set of words bound by a syntax that the computer and you know. This language consists of keywords, key phrases, and a syntax that ensures that the instructions are written and (more importantly) understood properly.

In computer science, this language needs to be exact, precise, unambiguous, and with a correct syntax. In other words, it needs to be exact.

When writing C# code, you will be following a syntax; this syntax will consist in a set of rules that will make it possible for you to communicate with Unity clearly and unambiguously.In addition to its syntax, C# also uses classes, and your C# scripts will, by default, be saved as classes.

In the next section, we will learn how to use this syntax. If you have already coded in JavaScript, some of the information provided in the rest of this chapter may look familiar and this prior exposure to JavaScript will definitely help you. This being said, UnityScript and C#, despite some relative similarities, are quite different in many aspects; for example, in C#, variables and functions are declared differently.

When scripting in C#, you will be using a specific syntax to communicate with Unity; this syntax will be made of sentences that will be used to convey information on what you would like the computer to do; these sentences or statements will include a combination of keywords, variables, methods, or events; and the next section will explain how you can confidently build these sentences together and consequently program in C#.