Version: 2017.4
GameObject
Using Components

Introduction to components

A GameObject is an object in the Unity Editor which contains components. Components define the behaviour of that GameObject.

This page describes how to view and interact with components, and provdes a brief overview of the most common component configurations in Unity.

To view a GameObject’s components, select the GameObject in the Scene window or Hierarchy window, then see the Inspector window for a list of all components and their settings.

You can interact with components directly in the Editor, or through script. See the Scripting section for guidance on how to control and interact with components through script.

Common component configurations

This section details some fundamental default component configurations in Unity.

Transform component

The Inspector of a new, empty GameObject showing the Transform Component
The Inspector of a new, empty GameObject showing the Transform Component

Every GameObject in Unity has a Transform component. This component defines the GameObject’s position, rotation, and scale in the game world and Scene view. You cannot remove this component.

The Transform component also enables the concept of parenting, which allows you to make a GameObject a child of another GameObject and control its position via the parent’s Transform component. This is a fundamental part of working with GameObjects in Unity.

Main Camera GameObject components

The Main Camera GameObject
The Main Camera GameObject

By default, every new Scene starts with a GameObject called Main Camera. This GameObject is confugured to act as the primary camera in your game. It contains the Transform component, the Camera component, and an Audio Listener to pick up audio in your application.

GameObject
Using Components
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961