Version: 2017.1

Component.GetComponentInChildren

Switch to Manual
public Component GetComponentInChildren (Type t);

Parameters

t @param type Тип возвращаемого компонента.

Returns

Component A component of the matching type, if found.

Description

Возвращает компонент типа type в GameObject или некоторого его потомка через поиск в глубину.

A component is returned only if it is found on an active GameObject.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public HingeJoint hinge; void Example() { hinge = GetComponentInChildren<HingeJoint>(); hinge.useSpring = false; } }

Returns

T A component of the matching type, if found.

Description

Дженерик функции. Для получения дополнительной информации смотрите страницу, посвященную Дженерик функциям.