Legacy Documentation: Version 2018.2 (Go to current version)
Scenes
GameObject
Other Versions

GameObjects

The GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
is the most important concept in the Unity Editor.

Every object in your game is a GameObject, from characters and collectible items to lights, camerasA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
and special effects. However, a GameObject can’t do anything on its own; you need to give it properties before it can become a character, an environment, or a special effect.

Four different types of GameObject: an animated character, a light, a tree, and an audio source
Four different types of GameObject: an animated character, a light, a tree, and an audio source

To give a GameObject the properties it needs to become a light, or a tree, or a camera, you need to add componentsA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary
to it. Depending on what kind of object you want to create, you add different combinations of components to a GameObject.

You can think of a GameObject as an empty cooking pot, and components as different ingredients that make up the recipe of your game. Unity has lots of different built-in component types, and you can also make your own components using the Unity Scripting API.

This section explains how GameObjects, components and the Scripting API fit together, and how to create and use them.


对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答