diff --git a/Extensions/Node.cs b/Extensions/Node.cs index 757d6ee..8087a5b 100644 --- a/Extensions/Node.cs +++ b/Extensions/Node.cs @@ -1,4 +1,5 @@ using Godot; +using IEnumerableNode = System.Collections.Generic.IEnumerable; namespace SupaLidlGame.Extensions; @@ -55,4 +56,13 @@ public static class NodeExtensions return node.GetNode("/root/BaseUI/" + "SubViewportContainer/UIViewport/CanvasLayer/MainUILayer/Main"); } + + public static IEnumerableNode GetChildrenEnumerable(this Node node) + { + int childCount = node.GetChildCount(); + for (int i = 0; i < childCount; i++) + { + yield return node.GetChild(i); + } + } }