(serial) Learn unity--while drinking coffee Chapter One Unity overview

Source: Internet
Author: User

As the first sentence of this book, in this eye-catching position again, I want to tell you that my idea is that you read this book as a deliberate come, but also want to inspire readers, so the directory structure only preserves chapters, no further subdivision. Important concepts are presented in a special way.

This chapter should be boring, and readers who know something about unity can skip it by themselves. Given the completeness of this book has to be a nonsense chapter.

What is Unity?

First, the reader needs to know clearly that unity is a tool or software that has exited version 5.0 at the time of the current book. It can also be said that unity is a good 3D game engine, its packaging for the underlying graphics interface for developers to save a lot of things, greatly reducing the traditional game development due to the development cycle and labor costs.

But the reader cannot think of unity as a language. Unity provides a graphical editing tool, as well as its compiler. The former we have agreed in this book as a narrow unity (which is simply called unity when we refer to this graphical editing tool later in this book). The latter book is directly referred to as the IDE.

Unity's cross-platform features

But all the books about unity are bound to talk about Unity's cross-platform features, and since it's a cliché that readers might as well use their web resources to understand, simply because unity's powerful cross-platform features give us a way to launch a beta version of a platform and quickly expand it to all platforms.

Unity-supported programming languages

In a narrow sense, unity directly supports 3 scripting languages, namely C #, JavaScript, and Boo.

The following two languages are generally accepted as C # because of their grammatical level. Broadly speaking, Unity also has the Shaderlab language for writing shader, and the GPU programming language CG. Broadly speaking, because Unity supports the import of DLLs, it is able to support more languages to write DLLs for scripting calls.

a quick understanding of unity World

In the visual editor, once we've installed unity, we'll see an already generated scene, the main camera. Start with a forward-looking description of the scene, the main camera and the game content of the image. Some of the knowledge will be explained in detail in the next chapter, "A pre-knowledge system for unity."

A unity project consists of multiple scenarios (scene), each of which can contain multiple cameras and multiple game bodies. Multiple cameras are distinguished by depth (Depth), the lightest-depth camera is the primary camera, and only one camera is the main camera. Cameras of different depths look at our scene from a different perspective, and the images seen in the final game screen are combined to give priority to the depth of each camera. The most understandable example is that we play a lot of games when the game screen has a translucent small map, in fact, is a combination of two cameras, a camera from behind the protagonist to observe the scene, another camera from the protagonist is directly above the scene, and only to depict the scene of the special elements and abstract as a point.

The relationship between multiple game bodies is more complex, in the hierarchy view we can organize the game body between the tree inertia, and later we will also through the game Script (component) to add an invisible link between the game body. There are also built-in components, such as joint components, that build intrinsic associations between game bodies. Written here, the author thinks that the concept of Gameobject can be thrown:

? In all untiy projects, the most basic unit is called Gameobject, the game object, even if we do not develop the game, but also to operate a variety of gameobject.

The basic unit is Gameobject, a project consists of a scene, a camera, a game body, and a script (component), while scenes and scripts are not part of the game object. The scene is quite special, but better understood. Then the camera is a special kind of game object. He has no appearance, and his role is to provide a perspective for the user to observe the scene. Imagine that two cameras in real life are relative and should be able to see each other. With two cameras in unity, there are no other game bodies.

No appearance of the game object in addition to the camera, there is a, called the Empty Game object (empty object). This thing is also flexible to use behind us.

? One thing to keep in mind before you learn: Unity's most special place is that any code must be attached to a gameobject to be executed by the game engine call.

Throw this sentence, hope that the reader can be remembered at the beginning of the study, in order to prevent writing a large number of code, run out completely unresponsive so that the afternoon did not find the reason for the situation (the author did this kind of thing). Readers familiar with the development of other programs should have an entrance concept. The entrance to the code in Unity is actually gameobject, and the code is executed by the engine by attachment, not quite the same as when we write the code that requires link, make, and so on.

Component--component

Where the script was mentioned earlier, I carefully labeled the component with parentheses. A careful reader should be able to understand that the script is actually a component. This book has no distinction between the concepts of components and scripts.

A game object without components is unthinkable, that is, it does not have any appearance or attributes. Such a scenario cannot be found in unity because any object has a component that cannot be deleted, called the transform component. The simplest empty game object (empty Gameobject) is comprised of a transform component. So I'm more inclined to think that the game object (Gameobject) is a container that is used to put components in a container.

Writing here, of course, I naturally throw the concept of the transform component again:

Important Component--transform

? When we create a game object (Gameobject), a built-in component that is bound to appear and is unique and cannot be deleted. He reflects the coordinates, degrees of rotation and scale of our game objects.

? Since Unity is a 3D game development engine, the 3 properties of the transform component have three dimensions.

? In unity, you often think in vector thinking. Because there are few scalars in unity, most of the common sense and variables are not matrices or vectors. Even the color, he is also a 4 yuan vector, red and green blue (why not red and yellow blue?) is the 3 component RGB of the color vector, and the 4th element is the opacity alpha.

? So the transform component consists of 3 vectors, namely the coordinate vector position, the rotation vector rotation and the scale vector size. We will also discuss the characteristics of these 3 vectors in more depth after the spatial matrix transformation.

Discussion on dimensions, vectors, and coordinate systems I'll mention in more detail in the next chapter, Unity's preparatory knowledge system, that readers can also access relevant information.

So in addition to this important component of transform, unity has a lot of built-in components, and we're going to introduce two relatively important:

Shape components Meshrenderer and material components matierial

Shape components, which we also call grid components. In the computer expression of three-dimensional graphics, are composed of a triangular mosaic and form a complex shape, like the roof of our nest, like a triangular net, so we often call it grid. The same is true in 3D modeling software. Unity's built-in shapes are only a few: spheres, cubes, cylinders, capsules, and so on, and we can often only create these basic shapes. In general, the game development we want to use the shape of very much, and often complex, but no need to worry about, these will be left to everyone in the future colleagues-game art in 3dmax/maya and other software to make the model file, we just need to import directly to create a beautiful beauty, such as 3D shape.

Materials often mimic the color information of the surface of objects in the real world. For example, glass is almost no color and transparent. For example, Metal has a special luster. The surface of the ball is uneven. Mirrors can reflect light. Different game objects have their own material settings, so we need to create the appropriate matierial component to attach to it. This is a narrow material, and I'm here to name it the exterior material.

In Unity game development, the world we simulate doesn't have visual effects, and it's often necessary to conform to physical laws, such as when I drive a car, and the car runs on the edge of the track instead of moving on. The materials in unity are in addition to the narrow appearance of materials, as well as physical materials. We'll mention it in detail later. Physical materials often express physical properties such as density, mass, elasticity coefficient and so on. Are some physical properties that cannot be observed by the naked eye.

The following is the subject of my previous series of articles shader, here to do a simple introduction, specific knowledge can read the series of articles.

The soul of the material--shader shader

Shaders provide a mathematical way of calculating our appearance materials. This means telling the computer how to simulate the visual effects of different materials. Beginner stage We only need to learn to use several basic built-in shader: Diffuse reflection diffuse, specular specular, parallax diffuse and specular parallax Diffuse/specular.

At the end of this chapter, we talk about the differences and connections between graphics, animations, and games.

The point moves into the line, the line moves into the face, the facial movement adult. This is what we have to say in maths in our compulsory education. The iffy point, in fact, is that it expresses the low-dimensional elements that move along the axis of the higher dimensions to form a high-dimensional entity.

The beginning of the animation is actually a page of continuous flipping, because of the phenomenon of visual stop to feel the picture in the continuous movement. That is to say, the graphic graph moves along the time dimension to form an animation, in short, continuous image formation.

and the animation plus user Operation control, can become the simplest game. Of course, complex games also have many features that are not animated. For example, a greedy snake. A snake is rushing forward, if there is no input of the direction key, then it is like a given cartoon. When the user input up and down and the program to change the direction of the snake to move forward to avoid obstacles, walls, their bodies, toward the direction of food. This can be called a game.

All right, chapter one, the end of the chapter of nonsense, I hope this chapter of nonsense does not affect the enthusiasm of the reader, destroy the reader to drink coffee good mood! In the next chapter we will fill in the gap between math and game programming, I think the next chapter is a must-read chapter, is a temporary skip but have to go back to cram chapters, is the cornerstone of our development.

(serial) Learn unity--while drinking coffee Chapter One Unity overview

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.