Unity3D基础教程2-1: 游戏对象/物体(GameObjects)

2014-08-06 07:39:11|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

Unity Manual > User Guide > Building Scenes > GameObjects

Unity 手册->用户指南->建立场景->游戏对象(物体)

GameObjects are the most important objects in Unity. It is very important to understand what a GameObject is, and how it can be used. This page will explain all that for you.

游戏对象(物体)是Unity里最重要的对象。了解一个游戏对象(物体)是什么以及如何使用它是非常重要的。本页将为你解释一切。

What are GameObjects?游戏对象是什么?

Every object in your game is a GameObject. However, GameObjects don't do anything on their own. They need special properties before they can become a character, an environment, or a special effect. But every one of these objects does so many different things. If every object is a GameObject, how do we differentiate an interactive power-up object from a static room? What makes these GameObjects different from each other?

你的游戏中的每个物体是一个游戏对象。然而,游戏对象它们自己不做任何事情。在它们能成为一个人物、一个环境或有一个特殊效果之前它们需要指定属性。但是任意一个这样的对象能做一样多的不同事情。如果每个对象(物体)是一个游戏对象(物体),我们如何从一个静态空间区分加电的互动对象?什么使得这些游戏对象彼此互不相同?

The answer to this question is that GameObjects are containers. They are empty boxes which can hold the different pieces that make up a lightmapped island or a physics-driven car. So to really understand GameObjects, you have to understand these pieces; they are called Components. Depending on what kind of object you want to create, you will add different combinations of Components to the GameObject. Think of a GameObject as an empty cooking pot, and Components as different ingredients that make up your recipe of gameplay. You can read more about Components here, but we recommend you finish reading this page first.

这个问题的答案是GameObjects(游戏对象(物体))是容器。它们是那个可以容纳组成一个灯光映射的岛屿的不同事项或一个物理驱动的汽车的空箱。因此要真正理解GameObjects(游戏对象),你必须理解这些事项;它们被称为Components(组件)。根据你想创建什么样的对象,你将添加不同成分的组件到GameObject(游戏对象(物体)里)。把一个GameObject(游戏对象(物体))想象成一个空的烹饪锅,而组件作为组成你游戏玩法食谱的不同成分。你可以阅读更多的组件在这里。但是我们建议你首先阅读完本页。

注意:据上面的翻译理解,GameObject 译成游戏物体比较合适。以下翻译成游戏物体

The GameObject-Component Relationship 游戏物体(对象)-组件关系

We now know that a GameObject contains Components. We'll explore this relationship by discussing the most common Component -- the Transform Component. With any Unity Scene open, create a new GameObject (using Shift-Control-N on Windows or Shift-Command-N on Mac), select it and take a look at the Inspector.

我们现在知道一个游戏物体(对象)包含组件。我们将探讨这种包含关系,通过讨论常见的公共组件- Transform 组件(变换组件)。利用任何Unity打开的场景,创建一个新的游戏物体(对象)(在windows上使用Shift+Ctrl+N键或在MAC上Shift+Command+N键),选取它并关注(属性)检视器。

Unity3D基础教程2-1: 游戏对象/物体(GameObjects)
The Inspector of an Empty GameObject 一个空的游戏物体的(属性)检视器

Notice that an empty GameObject still contains a Name, a Tag, and a Layer. Every GameObject also contains a Transform Component. It is impossible to create a GameObject in Unity without a Transform Component. All of the GameObject's Transform properties are enabled by its use of the Transform Component. The Transform Component just happens to be critical to all GameObjects, so each GameObject has one. But GameObjects can contain other Components as well.

注意一个空的游戏物体(对象)仍就包含一个名称、标签以及涂层。

Unity3D基础教程2-1: 游戏对象/物体(GameObjects)
The Main Camera, added to each scene by default 主摄像机,默认添加到每个场景

Taking a look at the Main Camera GameObject, we can see that it contains a different collection of Components. Specifically, a Camera Component, a GUILayer, a Flare Layer, and an Audio Listener. All of these Components provide additional functionality to the GameObject. Without them, there would be nothing rendering the graphics of the game for the person playing! Rigidbodies, Colliders, Particles, and Audio are all different Components (or combinations thereof) that can be added to any given GameObject.

<12>
发表评论0条 】
网友评论(共?条评论)..
Unity3D基础教程2-1: 游戏对象/物体(GameObjects)