Chapter 2: Scripting Concepts in Unity
In the previous chapter, we discussed scripting in Unity at a high level. In this chapter, we will introduce this topic in detail. We already know that Unity is internally written in C/C++, but it provides many C# APIs for game developers and allows us to implement game logic in C#. This means that not only can we write our own classes but also many built-in classes are available to us. So, before creating our own C# class, let's learn a bit about Unity's built-in classes first. The life cycle of Unity scripts is another important topic because we need to use different event functions provided by Unity to implement game logic. Then, we will introduce how to create a script in the Unity Editor and use it as a component.
We will cover the following key topics in this chapter:
- Understanding the concepts of scripting in Unity
- The life cycle of a script instance
- Creating a script and using it as a component
- Packages...