Copyright NOTICE: This article is the original blogger articles, reproduced please indicate the source.
Games, like movies, are done through the concatenation of each lens, which we call the "scene." A game typically consists of one or more scenes, which implement different functions and combine them into a complete game.
In the movie, each shot will contain the scene, then there will be actors in the performance, the camera will record the performance, and then become a movie. Similarly, the camera is also present in unity Games, and its role is to display the game's screen on the display of the game device. The difference is that in unity games, whether it's a scene or a character, everything we call the "Gameobject" game object (2D games are generally called "sprites"). So the game scene is composed of game objects, a scene is equivalent to a separate world, we can simply understand the game scene as a game object of a container.
Unity's hierarchy panel shows the game objects currently owned by the scene, and when the game is running, the objects on the hierarchy panel are refreshed in real time with the game. A new game scene will add a main camera object and a directional light (directional lighting) object by default. The main camera is responsible for projecting the game scene to the screen, and the direction light is responsible for illuminating the scene. When we remove the directional light from the scene, since there is no light in the scene, the game can only see a very dark screen after running. And if we remove the main camera object from the scene, we will not be able to see any game screen while the game is running.
In the movie, characters can have various kinds of information, such as character's identity tag, character, even his function. Similarly, our game objects can also have a variety of information, and this information is "component" (Component) in the way that exists. A game object is made up of one or more components, and we can consider a component as a component that makes up a single machine. Unity games are developed by means of components, so the object that you want to manipulate is also through the action of the corresponding Component object.
The
Randomly selects a game object on the hierarchy panel or in the scene view, and then we can see the corresponding component information on the Inspector panel. In general, the game object will have at least one component called "Transform". It is the basic component of the game object and contains the basic property information of the game object in the scene.
Transform has three important attributes: "position", "rotation", and "scale", respectively.
position contains the position information of the game object in the scene, whose data type is "Vector3" (three-dimensional vector), consisting of x, Y, and z three coordinate components.
rotation represents the rotation angle information of the game object in the scene, whose data type is "quaternion" (four), Quaternion.euler (x, Y, Z) method can be X, The rotation angle component above the Y and Z three axes is converted to a Euler angle, and a quaternion object is returned. So we can see that the rotation property of transform also contains the x, Y, and z three values.
Scale represents the scaling of the game object in the scene, which defaults to 1. Similarly, it also has X, Y, and z three components, so its value is also represented using the Vector3 type.
When we need to add a new component to a game object, we can simply click on the "Add Component" button below the last component of the Inspector panel to add it. A component selection panel appears below the button, and a search box at the top of the panel can be retrieved directly by entering the component name. The alternate list below lists the components built into unity, and we can also find the components we want by classifying them.
The following are the categories of components:
(1), Mesh: Grid components.
(2), Effects: effect components.
(3), Physics: physical components.
(4), Physics 2d:2d physical components.
(5), Navigation: Navigation components.
(6), Audio: sound components.
(7), Rendering: Render component.
(8), layout: layouts components.
(9), Miscellaneous: Other components.
(10), Event: Events component.
(11), Ui:ui element components.
(12), Scripts: The script component that was created.
(13), new script: Create a new scripting component.
There are several components below each category.
The concept of "Getting Started with unity" scenarios, game objects, and components