23 lines
514 B
C#
23 lines
514 B
C#
using UnityEngine;
|
|
|
|
namespace Utils
|
|
{
|
|
public static class GameObjectExtensions
|
|
{
|
|
public static Transform FindChildRecursive(this Transform parent, string name)
|
|
{
|
|
foreach (Transform child in parent)
|
|
{
|
|
if (child.name == name)
|
|
return child;
|
|
|
|
var result = FindChildRecursive(child, name);
|
|
|
|
if (result != null)
|
|
return result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |