private void RecursiveInit(IEngineModule component) { foreach (var field in component.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic).Where(f => f.GetCustomAttributes(false).Any(t => t is DependencyAttribute))) { if (field.FieldType == this.GetType()) { continue; } else { var c = GetEngineComponent(field.FieldType); RecursiveInit(c); } } if (_components.FirstOrDefault(x => x.Component == component).IsInitiated == false) { component.Initiate(); _components.FirstOrDefault(x => x.Component == component).IsInitiated = true; } }