得到组建的各种方法函数
BroadcastMessage 在此游戏对象或其任何子级中的每个MonoBehaviour上调用名为methodName的方法。
CompareTag 这个游戏对象是否带有标签?
GetComponent 如果游戏对象附加了一个,则返回Type类型的组件;如果没有,则返回null。
GetComponentInChildren 使用深度优先搜索返回GameObject或其任何子级中Type类型的组件。
GetComponentInParent 返回GameObject或其任何父代中Type类型的组件。
GetComponents 返回GameObject中Type类型的所有组件。
GetComponentsInChildren 返回GameObject或其任何子级中Type类型的所有组件。
GetComponentsInParent 返回GameObject或其任何父代中Type类型的所有组件。
SendMessage 在此游戏对象中的每个MonoBehaviour上调用名为methodName的方法。
SendMessageUpwards 在此游戏对象中的每个MonoBehaviour以及该行为的每个祖先上调用名为methodName的方法。
TryGetComponent 获取指定类型的组件(如果存在)。
GetInstanceID 返回对象的实例ID。
ToString 返回对象的名称。
public class API05GetComponent : MonoBehaviour {
public GameObject target;
// Use this for initialization
void Start () {
Cube cube = target.GetComponent<Cube>();
Transform t = target