FileBrowserWithColumns

Author: Inventor2010

Description
A single window file browser for opening and saving files at runtime. The user can move the window by dragging the bar at the top, resize it by dragging the handle at the bottom right or resize any column individually for easy viewing.

It can't yet move files or folders already there, but it allows the user to browse a directory that you specify (and all subdirectories in it). They can also create a new folder and name it how they see fit.

Note: If the user picks a name that conflicts with something already at the directory they choose, it will be overwritten without warning.

Setup
Simply add the script to an object you can reference, and add a single line of code to the script about a third the way down (where the large comment is) to run your open/load code.

Then in what ever script you want to access it from, use GetComponent (found here: ) to get a variable "Browser" that you can use later.

Usage
Simply call: Browser.OpenFile( The_Path_To_Your_MainSaves_Folder ); to allow the user to open any file in the directory you specify.

If you want to save a file you need to save it first how ever you would normally (xml, parsing your own text file, or even archiving a whole folder, any thing you have a path to) do this in a different directory from the one you want the user to be able to browse. Then just call:

Browser.SaveFolder(Temporary_Path_Of_The_Save_File_You_Just_Made, The_Path_To_Your_MainSaves_Folder);

...to open the file browser.

Then the user will basically just name it and move it where they want, though from what they see it will simply save there without them knowing about the temporary file you just made. If they choose cancel, the temporary file will be deleted automatically.

WARNING!!! Make sure that you do not pass a directory to Temporary_Path_Of_The_Save_File that you do not want to lose, as if the user clicks cancel, it will be instantly deleted without warning! This is normal behavior as it is meant to be a temporary file, I designed browser so other coders could implement it with only 2 lines of code, but I can not predict how you wish to save files, so all browser does is move them, if the user clicks cancel then the temporary file is deleted without the user knowing of it's existence.