Component.GetComponents Manual     Reference     Scripting  
Scripting > Runtime Classes > Component
Component.GetComponents
このドキュメントは有志により翻訳されたもので、オフィシャルではありません。オリジナルのページはこちら
This document is unofficially translated by users.Please see the original document here.

翻訳に関する修正など、ご連絡はこちらまで。
Please send e-mail to here, when you have any question about the translation.

編集 (GitHub)

function GetComponents (type : Type) : Component[]

Description

Returns all components of Type type in the GameObject.

JavaScripts
// Disable the spring on all HingeJoints
// in this game object
var hingeJoints : HingeJoint[];
hingeJoints = GetComponents (HingeJoint);
for (var joint : HingeJoint in hingeJoints) {
joint.useSpring = false;
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
public HingeJoint[] hingeJoints;
public void Awake() {
hingeJoints = GetComponents<HingeJoint>();
foreach (HingeJoint joint in hingeJoints) {
joint.useSpring = false;
}
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

public hingeJoints as (HingeJoint)

public def Awake():
hingeJoints = GetComponents[of HingeJoint]()
for joint as HingeJoint in hingeJoints:
joint.useSpring = false