public void OnGUI() { try { if (Event.current.type == EventType.Layout && close) { base.Close(); return; } if (!shown) { OnShow(); shown = true; } UnityAPI.Process(); Draw(); Repaint(); Resize(); UpdateTip(); if (Event.current.type == EventType.Repaint) { lastRepaintTime = DateTime.UtcNow; } } catch (ExitGUIException) { } catch (Exception ex) { base.Close(); Debug.LogException(ex); } }
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)); }
public void Run(object assigner, object assignee) { if (requiresAPI) { UnityAPI.Async(() => _Run(assigner, assignee)); } else { _Run(assigner, assignee); } }
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); } }