/// <summary> /// - Gets a file with a specified extension. /// </summary> /// <param name='startingDirectory'> /// - The directory to start the search in. /// </param> /// <param name='Callback'> /// - The function to call when the file has been selected. /// </param> /// <param name='extension'> /// - The extension of the desired file type. /// </param> public static void GetFile(string startingDirectory, SelectFileFunction Callback = null, string extension = ".*") { if (updater == null) { updater = new GameObject("Select File"); updater.AddComponent <FS_Cleanup>(); updater.hideFlags = HideFlags.HideInHierarchy; } FileSelector instance = updater.AddComponent <FileSelector>(); instance.Callback = Callback; instance.extension = extension; instance.path = startingDirectory; instance.destroyOnClose = true; instance.open = true; }
/// <summary> /// - Gets a file with a specified extension. /// </summary> /// <param name='Callback'> /// - The function to call when the file has been selected. /// </param> /// <param name='extension'> /// - The extension of the desired file type. /// </param> public static void GetFile(SelectFileFunction Callback = null, string extension = ".*") { GetFile(Application.dataPath, Callback, extension); }
/// <summary> /// - Gets a file with a specified extension. /// </summary> /// <param name='startingDirectory'> /// - The directory to start the search in. /// </param> /// <param name='Callback'> /// - The function to call when the file has been selected. /// </param> /// <param name='extension'> /// - The extension of the desired file type. /// </param> public static void GetFile(string startingDirectory, SelectFileFunction Callback = null, string extension = ".*") { if(updater == null) { updater = new GameObject("Select File"); updater.AddComponent<FS_Cleanup>(); updater.hideFlags = HideFlags.HideInHierarchy; } FileSelector instance = updater.AddComponent<FileSelector>(); instance.Callback = Callback; instance.extension = extension; instance.path = startingDirectory; instance.destroyOnClose = true; instance.open = true; }