private static void RecursivelyCreateModulesByName(List <string> ModuleNames, ref List <UEBuildModule> Modules, CreateModuleDelegate CreateModule, string ReferenceChain) { // Check whether the module list is already set. We set this immediately (via the ref) to avoid infinite recursion. if (Modules == null) { Modules = new List <UEBuildModule>(); foreach (string ModuleName in ModuleNames) { UEBuildModule Module = CreateModule(ModuleName, ReferenceChain); if (!Modules.Contains(Module)) { Module.RecursivelyCreateModules(CreateModule, ReferenceChain); Modules.Add(Module); } } } }