This version of Unity is unsupported.

Component.GetComponents

Declaration

public Component[] GetComponents(Type type);

Parameters

type The type of Component to retrieve.

Description

Returns all components of Type type in the GameObject.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { HingeJoint[] hinges = GetComponents<HingeJoint>(); for (int i = 0; i < hinges.Length; i++) { hinges[i].useSpring = false; } } }

Declaration

public T[] GetComponents();

Description

Generic version of this method.