mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 10:06:58 +00:00
13 lines
338 B
C#
13 lines
338 B
C#
using UnityEngine;
|
|
|
|
public static class ComponentHelper
|
|
{
|
|
public static T GetComponentInChildrenWithoutParent<T>(this Component obj) where T : Component
|
|
{
|
|
foreach (var comp in obj.GetComponentsInChildren<T>())
|
|
if (comp.gameObject != obj.gameObject)
|
|
return comp;
|
|
|
|
return null;
|
|
}
|
|
} |