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;

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

Returns

T A component of the matching type, if found.

Description

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