[RELEASED] In-Game FileBrowser v2.0

File Browser v2.0 is out !

And this one is a big update :

  • Full rework of the code and the UI.
  • You can now save files and select folders.
  • Module system : simply drag and drop the features you need.
  • Mobile support : finally !
  • Cross platform thumbnails : should now work on Windows, Mac, and Linux. Mobile targets MIGHT NOT support it, as thumbnails are created on the fly, and as such the work load might be too much.

Of course, features of the previous release are still here :

  • Bookmark system.
  • Folder and file management : Create, delete, rename, and move files and folders.
  • Sorting options by name, date, or type.
  • Filter files by extension and easily add new filters.
  • Thumbnails display for the jpeg and png files.
  • A search tool, so you can easily find any file.
  • An history system, to go back to the folder you previously visited.

So if you want your users to select and save files and folders at runtime with a fully customizable UI, this is the solution you need !

Ellenack

2046214--209241--icon_template.png

Looking clean and well done!Hope you develop it further.

I was wondering if there are any advantages for using the new UI over the onGUI() code for a file browser? using less memory or running faster?

Don’t know if you intend to use this for any other projects but here are all my additions/suggestions;
-Bookmarks/ Custom favorite folders.
-Thumbnail view (not so easy I guess )
-Sorting based on name,date,file type

totally not related to your project but if you intend to take it further;
-Folder only view.
-New Folder,Delete File/Folder.
-Sequential file detector; If the folder contains sequentially named files (test_001.png, test_002.png…) it shows them as one line but selection contains an array of file names. This might be useful for people using 3d renders and such.

Sorting, folder only view and folder creation/deletion will be easy I think, and would be a nice addition.

The bookmarks would be nice too. After a quick thought, it wont be as hard as I thought it would be. Saving them in a text file and parsing the file at launch would be enough.

I thought about thumbnails view. It will take some time to work it out. Generating them on the fly would be too resource consuming in my opinion. There must probable be some way to access the default thumbnails.

As for the sequential file detector, it would be a nice addition. I will have to think about how I manage it, but it should be possible.

Thanks for your feeback. I will try to post a new update at the end of the week. :slight_smile:

For the thumbnails; I think Editor class might have some functions for that business but does that translate to run-time…I don’t think so.
There are so many options when it comes to sequential file names. I guess its a pretty hard thing…very good if you can manage it.

In any way, I hope it turns out as you want :slight_smile:

Ok. I will start looking in both matters soon. I just finished getting other things working (sorting files, folder only, favorites, creation , deletion and renaming files). Added a screenshot in my first post. :slight_smile:

I will have to add a lot of safe guard to this so people do not mess up everything (and it’s not easy to test this kind of safe guard, I don’t want to try and delete important files on my own computer). But i looks like folders that aren’t empty can’t be deleted anyway. I made it so that files having the “system” or “hidden” attributes do not show up in the listing, but in the end, people can always find a way… Still have to give this some thought.

Hi everyone !

A quick update on the situation. I do not have the means to give you a proper screenshot right now, but here is what’s new at the time of writing :

  • Multithreading ! Yeah, it’s here. The search tool now work on another thread. It was hard to get it working (first time trying multithreading, a lot of things to take in). In still need to give a visual feedback, but it wont be the hardest part.

  • Thumbnails ! Well, I had to look at the System.Drawing namespace. It was all here. And… it is multithreaded too ! Had to go a bit more in depth here, first time using “lock” et “try/catch”. I will have to go back to the search thread function and make sur everything is safe. But, well, it works.

  • You can know scale the line sizes to make them bigger ( the thumbnail size follow, allowing you to have a better view of your files ). It’s a first step toward switching between differents view system (liste, tile, etc…).

So, thats it for now. :slight_smile:

1 Like

Very nice. I’m looking for something like this.

Well that’s perfect, I just got the mail, the current version is now live on the asset store ! :slight_smile: I will update my first message for more information.

Just a question:
I guess it’s then possible to take the selected file and use it within other scripts?

Yep, it is indeed possible. In the test scene included in the package, I used a small script. Well, he isn’t really important, so here is what it looks like :

using UnityEngine;
using System.Collections;

public class TestInput : MonoBehaviour
{
    public UI_FileBrowser _uiFB; // In the editor, you link the file Browser of your scene here.
    public string Path; // In the editor, you can set the default path folder when you open the file browser

    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.Space)) // Allow to open the file browser when "Space" is pressed
        {
            _uiFB.Open (Path); // Call a function to open the File Browser
        }

        if( _uiFB.GetPath() != null ) // Check if a file has been opened
        {
            Debug.Log( "Opened : "+_uiFB.GetPath() ); // Print the path of the opened file
        }
    }
}

The script of the package use a boolean to print the value only once, but that’s the only thing that differ.

_uiFB.GetPath() allow you to retrieve the path of the filed that was opened. The value is set to “null” when the File Browser is opened, so it’s easy to check when you open a file, as it is set automatically . :slight_smile:

It implies that you only get the path of the file. It’s up to you to then extract the data or open it te read a text file if you wan’t to.

Then I bought your assets, but does not seem to work file retrieval. Your test scripts will not print anything after selecting a file.

Hmmm. To open a file, you have to either double click it or press the open button. The file browser should then close and you should see the path of the file in the console. Do you need to retrieve the path of the file you have currently selected ?

With a double click. You need to recover the file path, and then go do various operations on that file.

And right now, what happens when you double click on a file in the test scene ? Nothing is printed in the Console ?

The file browser closes and the console does not print anything

Ok, I finally get it. It’s stupid, really. See, at first, the File Browser was hidden by default, so you had to press the Spacebar for it to show up. Doing so was initializing a boolean in the test script that allowed to print the path only once. But in the version I submitted, the File Browser is displayed by default, so the boolean is not inititialized and the condition to print the path is false. But if you press Spacebar again and open a file, it works.

The fix is as follow : in TestInput.cs, at line 8, set DoOnce to true.

My bad, I am really sorry that such a mistake made it to the release version. :slight_smile:

Thx, but i am stupid, was easy…

Well, if you have any more questions, do not hesitate to ask. And if you have time, please consider leaving a review once you have made up your mind on the package. Thanks. :slight_smile:

FileBrowser v2.0 is out !