Kursach_StealthAction/Assets/Tremble/Utils/GameObjectUtil.cs
2026-10-11 19:16:11 +03:00

28 lines
603 B
C#

//
// This file is part of the Tremble package by Tiny Goose.
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
//
using System;
using UnityEngine;
namespace TinyGoose.Tremble
{
public static class GameObjectUtil
{
public static GameObject Find_Recursive(this GameObject go, string findName)
{
if (go.name.EqualsInvariant(findName, caseSensitive: true))
return go;
for (int i = 0; i < go.transform.childCount; i++)
{
GameObject inner = Find_Recursive(go.transform.GetChild(i).gameObject, findName);
if (inner)
return inner;
}
return null;
}
}
}