public List<GameObject> _Objects;
void Start()
{
//子要素がある時のみ
if (GetChild(gameObject.transform))
{Debug.Log("取れたよ");}
}
bool GetChild(Transform _transform)
{
if (_transform.childCount <= 0){return false;}
for (int i = 0; i < _transform.childCount; i++)
{
_Objects.Add(_transform.GetChild(i).gameObject);
GetChild(_transform.GetChild(i));
}
return true;
}
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme