The beginning of Unity game programming

Source: Internet
Author: User
Tags object model

Game Object Gameobject

The basic elements of the hierarchy view, in unity, each gameobject has transform, which is a basic attribute that must be included in the Gameobject to mark its "presence", including the position (commonly used for panning), the angle of rotation (x, y, Z, Corresponds to the rotation angle along the x, Y, Z axis), scaling (representing the zoom size on the x, Y, Z axis, 1 for no scaling.) ), transform in the game engine is calculated using a matrix. Finally, the position of the pan is determined, the angle of rotation is reduced. Gameobject in Unity can also be an empty object, empty gameobject (but not null), which has transform. As you can see, Gameobject is more like a basic container that defines its behavior and performance in a way that adds components.Object Component ComponentUnity's scenario model can be simply understood as: game objects and components, the game object is a container, is to represent the existence of the model, and the component defines the behavior and performance of the model, the component is a script, the file name and the name of the file in the definition of the same names, must inherit Monobehaviour. The component is created by: gameobject.addcomponent or get the Component object from the game object: Gameobject. Getcomponent, not in new ways
The game objects add different components can become a model in the scene, here are some examples of simple classification and model: Abstract object: Gameobject can be represented as an invisible but real game model, such as a camera, the display of the entire scene depends on the projection of the camera , Unity uses a perspective projection in the 3D scene, which is much smaller and nearly large, and the projection area is a vertebral body, while the 2D scene is an orthographic projection, and the projection area is a cuboid. Light, the shadow of the object is dependent on its exposure, in some ordinary engine model, the scene does not light, imaging is completely black, because the model is not illuminated by the source is not visible, which is more realistic. Sound (audio): Sound playback and control;
Visual object Model: 3D scene of ordinary object model: box, sphere, cone and so on the scene is generally a flat image: Unity in the sprite to display the image, in a 3D engine 2D scene is to ignore the z-direction coordinates, so that it is right to the camera; UI object: Defines some objects as UI elements. buttons, panels, text, etc. particle systems (particle system): to mimic the display of tiny scene models such as raindrops, dust, and hail. Monobehaviour
The above-mentioned pieces are implemented on the basis of the game objects for which they are added.
resource File Assets
A collection of game objects can be stored in a scene file, with the scene suffix component being scripted, which must inherit Monobehaviour. The default resource is for the reuse of the game object, and each preset instance in the scene is a clone of the original preset, which saves only one copy of the game object's data in the preset.
And all the other game resources.
component-to-object inheritance relationships

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.