Component.GetComponents Manual     Reference     Scripting  
Scripting > Runtime Classes > Component
Component.GetComponents

function GetComponents (type : Type) : Component[]

Description

Returns all components of Type type in the GameObject.

JavaScript
// 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;
}