用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:component:component

Component 组件

Namespace: UnityEngine
Inherits from: Object

Description 描述

Base class for everything attached to GameObjects.

所有附件到游戏对象的基类。

Note that your code will never directly create a Component. Instead, you write script code, and attach the script to a GameObject. See Also: ScriptableObject as a way to create scripts that do not attach to any GameObject.

请注意,您的代码将永远不会直接创建一个组件。而是,你写脚本代码,附加脚本到一个游戏对象上。另参见:ScriptableObject作为一种方法来创建脚本,不附加到任何游戏对象。

Variables 变量

animation The Animation attached to this GameObject (null if there is none attached).
附加到此游戏对象的Animation(如无附加则为空)。
audio The AudioSource attached to this GameObject (null if there is none attached).
附加到此游戏对象的AudioSource(如无附加则为空)。
camera The Camera attached to this GameObject (null if there is none attached).
附加到此游戏对象的Camera(如无附加则为空)。
collider The Collider attached to this GameObject (null if there is none attached).
附加到此游戏对象的Collider (如无附加则为空)。
collider2D The Collider2D component attached to the object.
附件到此对象上的Collider2D组件。
constantForce The ConstantForce attached to this GameObject (null if there is none attached).
附加到此游戏对象的ConstantForce (如无附加则为空)。
gameObject The game object this component is attached to. A component is always attached to a game object.
组件附加的游戏对象。组件总是被附加到游戏对象上。
guiText The GUIText attached to this GameObject (null if there is none attached).
附加到此游戏对象GUIText组件(如果没有则为空)。
guiTexture The GUITexture attached to this GameObject (Read Only). (null if there is none attached).
附加到此游戏对象GUITexture 组件(只读)。(如果没有则为空)。
hingeJoint The HingeJoint attached to this GameObject (null if there is none attached).
附加到此游戏对象HingeJoint组件(如果没有则为空)。
light The Light attached to this GameObject (null if there is none attached).
附加到此游戏对象Light组件(如果没有则为空)。
networkView The NetworkView attached to this GameObject (Read Only). (null if there is none attached).
附加到此游戏对象NetworkView组件(如果没有则为空)。
particleEmitter The ParticleEmitter attached to this GameObject (null if there is none attached).
附加到此游戏对象ParticleEmitter组件(如果没有则为空)。
particleSystem The ParticleSystem attached to this GameObject (null if there is none attached).
附加到此游戏对象ParticleSystem组件(如果没有则为空)。
renderer The Renderer attached to this GameObject (null if there is none attached).
附加到此游戏对象Renderer组件(如果没有则为空)。
rigidbody The Rigidbody attached to this GameObject (null if there is none attached).
附加到此游戏对象Rigidbody组件(如果没有则为空)。
rigidbody2D The Rigidbody2D that is attached to the Component's GameObject
附加到此游戏对象Rigidbody2D 组件。
tag The tag of this game object.
此游戏对象的标签。
transform The Transform attached to this GameObject (null if there is none attached).
附加到此游戏对象Transform组件(如果没有则为空)。

Functions 函数

BroadcastMessage Calls the method named /methodName/ on every MonoBehaviour in this game object or any of its children.
在该游戏对象的和它的全部子对象上每一MonoBehaviour调用名为methodName的方法。
CompareTag Is this game object tagged with /tag/?
此游戏对象是否被标记为tag标签?
GetComponent Returns the component of Type /type/ if the game object has one attached, null if it doesn't.
如果游戏对象有附加type类型的组件,则返回,如果没有则为空。
GetComponentInChildren Returns the component of Type /type/ in the GameObject or any of its children using depth first search.
返回此游戏对象上type类型的组件或任何它的子对象,使用深度首先搜索。
GetComponentInParent Returns the component of Type /type/ in the GameObject or any of its parents.
返回次对象或任何它的父对象type类型的组件。
GetComponents Returns all components of Type /type/ in the GameObject.
返回此对象type类型的所有组件。
GetComponentsInChildren Returns all components of Type /type/ in the GameObject or any of its children.
返回此游戏对象与其子对象所有type类型的组件。
GetComponentsInParent Returns all components of Type /type/ in the GameObject or any of its parents.
返回此游戏对象与其父对象所有type类型的组件。
SendMessage Calls the method named /methodName/ on every MonoBehaviour in this game object.
在此游戏对象所有MonoBehaviour上调用名称为methodName的方法。
SendMessageUpwards Calls the method named /methodName/ on every MonoBehaviour in this game object and on every ancestor of the behaviour.
调用此游戏对象及其behaviour的父对象上所有MonoBehaviour名为methodName的方法。
script/unityengine/classes/component/component.txt · 最后更改: 2016/08/02 05:24 (外部编辑)