public static void ShowDialog <T>(string defaultDestinationPath, Action <T>?onScriptableObjectCreated = null) where T : ScriptableObject { var selector = new ScriptableObjectSelector <T>(defaultDestinationPath, onScriptableObjectCreated); if (selector.SelectionTree.EnumerateTree().Count() == 1) { selector.SelectionTree.EnumerateTree().First().Select(); selector.SelectionTree.Selection.ConfirmSelection(); } else { selector.ShowInPopup(200); } }
public static void ShowDialog <T>(string defaultDestinationPath, Action <T> onScritpableObjectCreated = null) where T : ScriptableObject { var selector = new ScriptableObjectSelector <T>(defaultDestinationPath, onScritpableObjectCreated); if (selector.SelectionTree.EnumerateTree().Count() == 1) { // If there is only one scriptable object to choose from in the selector, then // we'll automatically select it and confirm the selection. selector.SelectionTree.EnumerateTree().First().Select(); selector.SelectionTree.Selection.ConfirmSelection(); } else { // Else, we'll open up the selector in a popup and let the user choose. selector.ShowInPopup(200); } }