Component
- animation
- audio
- BroadcastMessage
- camera
- collider
- CompareTag
- constantForce
- gameObject
- GetComponent.<T>
- GetComponentInChildren.<T>
- GetComponentInChildren
- GetComponents.<T>
- GetComponentsInChildren.<T>
- GetComponentsInChildren
- GetComponents
- GetComponent
- guiTexture
- guiText
- hingeJoint
- light
- networkView
- particleEmitter
- renderer
- rigidbody
- SendMessageUpwards
- SendMessage
- tag
- transform
Component.GetComponentInChildren 获取子物体组件
function GetComponentInChildren (t : Type) : Component
Description描述
Returns the component of Type type in the GameObject or any of its children using depth first search.
Only active components are returned.
返回Type类型组件,在GameObject或它的任何子物体使用深度优先搜索,仅返回激活的组件。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public ScriptName script;
public void Awake() {
script = GetComponentInChildren<ScriptName>();
script.DoSomething();
}
}
var script : ScriptName;
script = GetComponentInChildren(ScriptName);
script.DoSomething ();
最后修改:2010年12月11日 Saturday 15:26