GameObjects 游戏对象

优质
小牛编辑
132浏览
2023-12-01

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 also make your own Components using Scripts.

答案是游戏对象是一种容器。它们是空盒,可以容纳一个光照贴图的岛屿或物理驱动的小车的不同部分。因此,要真正理解游戏对象,你必须了解这些被称为组件的部分。根据你要创建的对象性质,添加不同的组件组合到游戏对象中。想象一个游戏对象是一口锅,组件是不同的作料,它们构成了你的游戏食谱。你也可以让你自己的组件使用脚本。

You can read more about GameObjects, Components, and Script Components on the pages in this section:

在本节中阅读更多关于游戏对象、组件和脚本的内容: