Version: 2017.2
public Component[] GetComponents (Type type);

파라미터

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

public T[] GetComponents ();

설명

Generic version. See the Generic Functions page for more details.