C# scripts and common UI components in Unity
uGUI has been provided as a built-in package in the Unity Editor since Unity 2019; therefore, we can see the content of the uGUI package directly in the Project window, which also includes the C# source code.
As we mentioned in the previous chapter, the Unity development workflow is primarily built around the structure of components. uGUI is no exception. It is a component-based UI system that uses different components to provide different UI functions. For example, every button, text, or image you see in the UI is actually a GameObject
with a set of components.
As shown in Figure 3.1, we can find the C# source code of many commonly used UI elements, such as Text, Slider, and Toggle. However, some UI components are implemented using C++ code inside the engine, such as Canvas, and the code of such components cannot be viewed from within the Unity Editor.
In this section,...