TransformHandle.GetChild
Declaration
public TransformHandle GetChild(int index);Параметры
| Параметр | Описание |
|---|---|
| индекс | Индекс возвращаемого дочернего преобразования. Должно быть меньше TransformHandle.childCount. |
Возвращаемое значение
TransformHandle Transform дочерние по индексу.
Описание
Возвращает дочернее преобразование по индексу.
Если у Transform нет дочерних объектов или значение аргумента index больше их количества, возникает ошибка. В этом случае выводится сообщение "Transform child out of bounds". Количество дочерних объектов можно получить с помощью childCount.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public TransformHandle meeple; public TransformHandle grandChild;
public void Example() { //Assigns the transform of the first child of the Game Object this script is attached to. meeple = this.transformHandle.GetChild(0);
//Assigns the first child of the first child of the Game Object this script is attached to. grandChild = this.transformHandle.GetChild(0).GetChild(0); } }