type | The type of Component to retrieve. |
Returns all components of Type type
in the GameObject.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public HingeJoint[] hingeJoints; void Example() { hingeJoints = GetComponents<HingeJoint>(); foreach (HingeJoint joint in hingeJoints) { joint.useSpring = false; } } }
Generic version. See the Generic Functions page for more details.