Component.GetComponentsInParent

Cambiar al Manual
public Component[] GetComponentsInParent (Type t, bool includeInactive= false);

Parámetros

tEl tipo de Component para recuperar.
includeInactive¿Los Components inactivos deben ser incluidos en el set encontrado?

Descripción

Retorna todos los componentes de tipo type en el GameObject o cualquiera de sus padres.

using UnityEngine;

public class GetComponentsInParentExample : MonoBehaviour { public Component[] hingeJoints;

void Start() { // Disable the spring on all HingeJoints // in this game object and all its parent game objects hingeJoints = (HingeJoint[])gameObject.GetComponentsInParent(typeof(HingeJoint));

foreach (HingeJoint joint in hingeJoints) { joint.useSpring = false; } } }

public T[] GetComponentsInParent (bool includeInactive);
public T[] GetComponentsInParent ();

Parámetros

includeInactive¿Los Components inactivos deben ser incluidos en el set encontrado?

Descripción

Generic version of this method.