Unity common script class inheritance diagram

Preface
Beginners learning the Unity development engine will come into contact with a large number of script classes, and the relationship between these classes is often easily overlooked.
This article briefly summarizes some common classes and their relationships in Unity engine development.

The first address of the blog post: http://blog.csdn.net/duzixi

Unity common script class inheritance diagram

Write picture description here
Friends who have a little knowledge of Unity development know that there are four basic levels in the Unity development framework: project (application), scene, game object and component.
In the script, the entire application and scene are controlled by the Application class; and the game objects and component classes inherit from the Object class.
Among the derived classes of the Object class, there are also some classes, most of which are resources and are components of components and game objects.
There are also some commonly used classes that do not inherit from the Object class in UnityEngine. Functionally, it can be seen that the main function of these classes is to perform macro control from a certain aspect.
In this sense, the Application class can be classified into one category with other classes that have macro-control functions.

In this way, the commonly used script classes in Unity can be simply divided into the following four categories:

1.
The main function of the macro control class is to truly control a certain aspect of the Unity program at a macro level.
Including:
Application - application class
Input - input class
GUI - graphics output class
Physics - physics engine class
Resources - resource class
Time - time class
, etc.

2. GameObject (GameObject) class
Since Unity is a component-oriented development model (rather than object-oriented), it can also be seen from the inheritance relationship of the classes:
not much is written about the GameObject class, but more The content is handed over to the component class below.

3. Component class
The component class in script development can often correspond to the inspection panel in the graphical interface.
The detailed settings and manipulation of each game object need to be completed with the help of component classes.
Among the commonly used component classes, there are two inheritance relationships that need special mention:
(1) The character controller (CharacterController) class inherits from the collider (Collider) class
(2) There is a group of classes that do not directly inherit from the component class, but Indirect inheritance by inheriting the Behavior class, including the well-known MonoBehavior class.
As for why the class is designed like this, we will not discuss it in depth in the introductory chapter. But we can first form a perceptual understanding based on our existing knowledge of these component classes.

4. Resource category
For beginners who are just getting started, resources are generally used directly after being imported into the graphical interface.
There are not many situations where resources are created through scripts or the resources themselves are modified.
Personally, I think that being proficient in resource classes is an important step out of the beginner stage, and it is also an important means for code development to get rid of material restrictions.

Postscript
: The three categories of basic, expanded and advanced are marked with color in the picture.
This is for beginners. For experienced Unity developers, these commonly used classes should all be "basic".
On the other hand, everyone’s learning route is different, and the stage divisions will be different. This is for reference only.

This field is still relatively shallow, and seniors from all walks of life are welcome to provide additional corrections.

Guess you like

Origin blog.csdn.net/zhaohuappc/article/details/71272245