[Unity] inheritance relationships of common scripts (entry) and unity

Source: Internet
Author: User

[Unity] inheritance relationships of common scripts (entry) and unity

Preface

Beginners who learn the Unity development engine will be exposed to a large number of script classes, and the relationships between these classes are often overlooked.

This article summarizes some common classes in Unity engine development and their relationships.


Blog address: http://blog.csdn.net/duzixi


Commonly used scripts of Unity



Anyone familiar with Unity development knows that there are four basic layers in the Unity development framework: Engineering (applications), scenarios, Game objects, and components.

In the script, the entire Application and scenario are controlled by the Application class, while the game Object and component class both inherit from the Object class.

There are also some classes in the derived classes of the Object class. Most of them belong to resources and constitute components and components of Game objects.

Some common classes do not inherit from the Object class in the UnityEngine. From the function, we can see that the main function of these classes is to carry out macro control from one aspect.

In this sense, the Application class and other classes with macro control can be classified into one class.


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


I. Macro Control

The main function is to implement macro control on one aspect of the Unity program.

Including:

Application -- Application class

Input -- Input class

GUI-graphical output class

Physics-physical engine class

Resources -- Resource

Time -- Time class

And so on.


Ii. Game objects

Since Unity is a component-oriented development model (rather than object-oriented), we can also see from the inheritance relationship of classes:

There is not much ink on the GameObject class, but more content is handed over to the component class below.


Iii. Component class

Component classes in script development can often correspond to the view panel in the graphic interface.

The detailed settings and control of each game object must be completed using the component class.

In common component classes, there are two inheritance relationships that need to be specifically mentioned:

(1) The role controller class inherits from the Collider class.

(2) A group of classes does not directly inherit from the component class, but indirectly inherit from the Behavior class, including the well-known MonoBehavior class.

As to why the design class is like this, I will not discuss it in depth in the first article. However, we can first form a perceptual knowledge based on the existing cognition of these component classes.


Iv. Resources

For beginners, the resources are generally directly used after the graphic interface is imported.

There are not many situations where you can create or modify resources by using scripts.

In my opinion, proficient in resources is an important step out of the beginner stage and an important means for code development to get rid of material limitations.


Background

In the figure, the basic, extended, and advanced categories are marked with colors.

This is for beginners. For experienced Unity developers, these common classes should all be "Basic ".

On the other hand, each person has different learning routes and stages are also divided for reference only.


This field is still easy to get involved in. You are welcome to add and correct your predecessors.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.