GameObjects
游戏对象
The GameObject is the most important type of object in Unity. It is very important to understand what a GameObject is, and how it can be used.
游戏对象是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 each of these objects do very 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?
任何在你游戏中对象都是游戏对象.然而,游戏对象本身不能做任何事.在它们成为角色,环境或特定效果前它们需要一些特性.但每个对象做完全不同的事情.如每个对象都是游戏对象,我们如何在一个静态空间里区分一个交互式被激活的对象呢?什么使这些游戏对象彼此不同呢?
Four different Game Objects, an animated character, a light, a tree and an audio source
四个不同游戏对象,一个动画角色,一个灯光,一颗树和一个声音源.
The answer to this question is that GameObjects are containers. They can hold the different pieces that are required to make up a character, a light, a tree, a sound, or whatever else you would like to build. So to really understand GameObjects, you have to understand these pieces which 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. Unity has lots of different built-in component types, and you can also make your own Components using Scripts.
依赖你想创建对象的种类,你将添加不同组件的组合到游戏对象里.可以把游戏对象想像为一个空的烹饪器,而组件是不同的材料用来制作你游戏的食谱.Unity有许多不同的内建组件类型,你也可以使用脚本制作你自己的组件.
This section explains how Game Objects, Components and Scripts fit together, and how to create and use them.
这部分介绍了游戏对象,组件和脚本如何组装在一起和怎样创建和使用它们.