static ICustomBootstrap CreateBootStrap() { #if !UNITY_DOTSRUNTIME var bootstrapTypes = TypeManager.GetTypesDerivedFrom(typeof(ICustomBootstrap)); Type selectedType = null; foreach (var bootType in bootstrapTypes) { if (bootType.IsAbstract || bootType.ContainsGenericParameters) { continue; } if (selectedType == null) { selectedType = bootType; } else if (selectedType.IsAssignableFrom(bootType)) { selectedType = bootType; } else if (!bootType.IsAssignableFrom(selectedType)) { Debug.LogError("Multiple custom ICustomBootstrap specified, ignoring " + bootType); } } ICustomBootstrap bootstrap = null; if (selectedType != null) { bootstrap = Activator.CreateInstance(selectedType) as ICustomBootstrap; } return(bootstrap); #else throw new Exception("This method should have been replaced by code-gen."); #endif }