お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Closetype | 取得するコンポーネントの型 |
深さ優先探索でゲームオブジェクトまたはゲームオブジェクトの子たちの type
からコンポーネントを取得します。
アクティブのコンポーネントのみ返します。
// Disable the spring of the first HingeJoint component // found on any child object. var hinge : HingeJoint; hinge = gameObject.GetComponentInChildren(HingeJoint); hinge.useSpring = false;
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public HingeJoint hinge; void Example() { hinge = gameObject.GetComponentInChildren<HingeJoint>(); hinge.useSpring = false; } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): public hinge as HingeJoint def Example() as void: hinge = gameObject.GetComponentInChildren[of HingeJoint]() hinge.useSpring = false
ジェネリック版。詳細については Generic Functions を御覧ください