| t | 取得するコンポーネントの型 |
| includeInactive | 非アクティブのコンポーネントも含めるかどうか |
GameObject や深さ優先探索を活用して、親子関係にある親オブジェクトから type のタイプのコンポーネントを「すべて」取得します。
// Disable the spring on all HingeJoints
// in this game object and all its parent game objects
hingeJoints = (HingeJoint[]) gameObject.GetComponentsInParent(typeof(HingeJoint));
foreach (HingeJoint joint in hingeJoints) {
joint.useSpring = false;
}
| includeInactive | 非アクティブのコンポーネントも含めるかどうか |
ジェネリック版。詳細については Generic Functions を参照してください。