Summary
In this chapter, we started by introducing some of the most commonly used classes in Unity script programming, and then explained the life cycle and important event functions of a script instance, as well as discussing how Unity initializes a script and how the game logic is updated in a script.
We also discussed how to create a new script in Unity and how to attach a script as a component to a GameObject. In addition to manually adding components in the Editor, we can also use C# code to dynamically add a component or access a component at runtime.
Finally, we demonstrated how to add or remove a package through the Unity Package Manager to provide a feature or reduce the size of the game. At the same time, we also explained the difference between preview packages and verified packages.
In the next chapter, we will learn about the UI system in Unity and, at the same time, we will also introduce how to optimize UI performance in Unity.