PuzzleGame/PuzzleGameProject/Assets/Scripts/Helper.cs
2025-01-19 18:59:50 +01:00

18 lines
497 B
C#

using UnityEngine;
using System.Collections.Generic;
using System.Linq;
public static class Helper
{
public static GameObject[] GetTaggedChildren(GameObject parent, string tag) {
List<GameObject> childrenWithTag = new List<GameObject>();
foreach (Transform child in parent.transform)
{
if (child.CompareTag(tag))
{
childrenWithTag.Add(child.gameObject);
}
}
return childrenWithTag.ToArray();
}
}