quakeball/Assets/Scripts/Util/TransformUtil.cs

21 lines
583 B
C#
Raw Normal View History

2020-08-09 19:33:23 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace NeonTea.Quakeball.Util {
public static class TransformUtil {
public static Transform FindChildWithName(Transform t, string name) {
if (t.name == name) {
return t;
}
for (int i = 0; i < t.childCount; i++) {
Transform child = FindChildWithName(t.GetChild(i), name);
if (child != null) {
return child;
}
}
return null;
}
}
}