Fundamentals
With Visual Studio installed and connected it to Unity’s editor, we should go over the basics. In this section we will talk about data types, variables, logic or code flow, functions, classes, and MonoBehaviour. There is a lot of knowledge to be held in this section of this chapter, but it is meant to be referenced. If you have a sticky note, it might be a good idea to place it in these chapters to easily be referenced. When you open the file, there will be autopopulated C# that we will not need for this part. For now, delete the extra parts so that way it looks like this:
using UnityEngine;
public class ScriptingLesson : MonoBehaviour
{
// Data and Variables
// Logic and Flow
// Functions
}
The code here is doing two primary tasks. The first line imports the library of UnityEngine
so that we can use classes from UnityEngine
for our game. It also allows us to create the next portion which is a class named “ScriptingLesson
” that inherits from MonoBehaviour...