public override void Prewarm() { base.Prewarm(); if (scene != null) { sceneObjects = UnityAPI.Await ( () => UnityObjectUtility .FindObjectsOfTypeInScene(type, scene.Value) .Where(uo => predicate?.Invoke(uo) ?? true) .ToDictionary(uo => uo, uo => uo.name) ); } if (allowAssetObjects) { assetObjects = UnityAPI.Await ( () => AssetUtility.FindAllAssetsOfType(type) .Where(uo => predicate?.Invoke(uo) ?? true) .ToDictionary(uo => uo, uo => uo.name) ); } }
private UnityObjectOption AssetOption(UnityObject uo) { if (!assetObjects.TryGetValue(uo, out var label)) { label = UnityAPI.Await(() => uo.name); } return(new UnityObjectOption(label, typeLabel, typeIcon, uo, false, FuzzyOptionMode.Leaf)); }
private static IEnumerable <object> FindAllAssetStubs() { return(UnityAPI.Await(() => LinqUtility.Concat <object> ( AssetUtility.FindAllAssetsOfType <IAotStubbable>() .SelectMany(aot => aot.aotStubs), AssetUtility.FindAllAssetsOfType <GameObject>() .SelectMany(go => go.GetComponents <IAotStubbable>() .SelectMany(component => component.aotStubs)) ).ToArray())); }
private IEnumerable <IFuzzyOption> Children(string pathFromProject) { var fullPath = Path.Combine(Paths.project, pathFromProject); foreach (var directory in Directory.EnumerateDirectories(fullPath)) { yield return(new AssetFolderOption(PathUtility.FromProject(directory), FuzzyOptionMode.Branch)); } foreach (var assetChild in UnityAPI.Await(() => LoadedAssetChildren(fullPath).ToArray())) { yield return(assetChild); } }