private static ECSComponentDatabase Populate <T>(NativeHashMap <int, int> map) { using (var pooledList = ListPool <SearcherItem> .GetDisposable()) using (var pooledDict = DictionaryPool <string, SearcherItem> .GetDisposable()) { var list = pooledList.List; var dict = pooledDict.Dictionary; var componentRoot = new SearcherItem(typeof(T).Name); list.Add(componentRoot); var collection = TypeCache.GetTypesDerivedFrom <T>(); foreach (var type in collection) { if (type.IsGenericType || type.IsAbstract || type.ContainsGenericParameters) { continue; } if (null != type.GetCustomAttribute <HideInInspectorAttribute>() || null != type.Assembly.GetCustomAttribute <HideInInspectorAttribute>() || ShouldTemporarilyIgnoreType(type)) { continue; } if (typeof(ISystemStateComponentData).IsAssignableFrom(type) || typeof(ISystemStateSharedComponentData).IsAssignableFrom(type) || typeof(ISystemStateBufferElementData).IsAssignableFrom(type)) { continue; } try { var index = TypeManager.GetTypeIndex(type); if (!map.TryGetValue(index, out _)) { var component = new TypeSearcherItem(type); var @namespace = type.Namespace ?? "Global"; if (!dict.TryGetValue(@namespace, out var item)) { dict[@namespace] = item = new SearcherItem(@namespace); componentRoot.AddChild(item); } item.AddChild(component); } } catch (Exception) { // ignored } } foreach (var kvp in dict) { kvp.Value.Children.Sort(CompareByName); } componentRoot.Children.Sort(CompareByName); return(new ECSComponentDatabase(list)); } }