diff --git a/Arch.System/Systems.cs b/Arch.System/Systems.cs index 1b19b4a..24b9049 100644 --- a/Arch.System/Systems.cs +++ b/Arch.System/Systems.cs @@ -174,7 +174,28 @@ public Group Add(ISystem system) return this; } - + + /// + /// Get all systems which can be cast into the given type + /// + /// + /// + public IEnumerable Get() + where G : ISystem + { + foreach (var item in _systems) + { + if (item.System is G sys) + yield return sys; + + if (item.System is Group grp) + { + foreach (var nested in grp.Get()) + yield return nested; + } + } + } + /// /// Initializes all 's in this . ///