GameObject.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 = gameObject.GetComponents.<HingeJoint>();
for (var joint : HingeJoint in hingeJoints) {
joint.useSpring = false;
}

function GetComponents.<T> () : T[]

Description