Simple File Browser [Open Source]

Thanks for all the input! I had added Canvas component to Files object primarily for performance concerns but I think that might have been an overkill. Removing it will also reduce the number of SetPass calls and Batches. I may just get rid of it and push an update.

Thanks to you for creating this in the first place! That recycled list view is great!

Glad to help!

Hey, thank you for the plugin!
It is working fine, I just have some concerns about these messages appearing on the Debug Console saying there are multiple event systems on the scene. Is that normal?

It is a harmless warning: SimpleFileBrowserCanvas prefab includes an EventSystem object in case current scene doesn’t have any. An EventSystem is mandatory to interact with UI. But if your scene already has an EventSystem, you can safely deactivate the EventSystem child object of the SimpleFileBrowserCanvas prefab. Or, if you won’t mind the warnings, you can just leave everything as is.

Thanks for the reply :slight_smile:

could i import a 3d model or 3d object through this project… file extension could be any!!

This plugin will only return the path of the selected file. It is then up to you to process that file. It seems like there are some runtime OBJ importers out there already but you may have a harder time finding an FBX importer. Supporting any extension will be even harder.

Hello,
first at all, thank you for this great asset !

But i have a small issue :
When i build my game to android, in development build, the explorer works great ! But if i export it in release build, the file explorer don’t shows up…

Thank you in advance,
Best Reguards,
Alexandre Desfontaines.

Are you using Mono or IL2CPP? Can you check logcat for error messages?

I’m using “Mono” scripting backend and i’ve got “Object reference not set to an instance of an Object” error in logcat.

Thank you for your fast response !
Best Reguards
Alexandre Desfontaines.

I can’t reproduce the issue on release Android build so we will have to dig deeper. Can you change the Instance property of FileBrowser.cs like this:

private static FileBrowser Instance
{
    get
    {
        if( m_instance == null )
        {
            Debug.Log( "AAAAAA" );
            m_instance = Instantiate( Resources.Load<GameObject>( "SimpleFileBrowserCanvas" ) ).GetComponent<FileBrowser>();
            Debug.Log( "BBBBBB" );
            DontDestroyOnLoad( m_instance.gameObject );
            Debug.Log( "CCCCCC" );
            m_instance.gameObject.SetActive( false );
        }
        Debug.Log( "DDDDDD" );
        return m_instance;
    }
}

Which debug lines are logged to logcat?

I can see the “DDDDDD” debug.log but i’ve got the error after the debug.log.

I’ve got something more that could be interesting : Screenshot by Lightshot
Hope that could help.
ExportCoroutine is my coroutine to export a file.

If you have a SimpleFileBrowserCanvas instance in your scene, try deleting it and see if it changes anything. If not, insert a Debug.Log to each line of FileBrowser.SetFiltersPostProcessing function to pinpoint the problematic line.

for ( int i = 0; i < filters.Count; i++ )
            {
                string filterStr = filters[i].ToString();
                dropdownValues.Add( filterStr );

                maxFilterStrLength = Mathf.Max( maxFilterStrLength, Instance.CalculateLengthOfDropdownText( filterStr ) );
            }

This is the part who crash the script, i don’t get logs after, I’ll try to isolate the line.

1 Like

string filterStr = filters*.ToString();*
This line is causing the error. I’ll try to reimport the asset. Maybe i’ve touche something…

Probably allFilesFilter of the FileBrowser is not initialized (Awake function). But this doesn’t make much sense because Awake is called immediately after an object is instantiated or when scene starts. Therefore, my guess is that FileBrowser.Awake throws an exception before allFilesFilter is initialized.

Can you make sure that allFilesFilter is initialized by putting a Debug.Log after that line? Also it may be helpful to see the portion of your script that calls FileBrowser. Finally make sure there is no FileBrowser in your current scene or one of your previous scene(s).

Your guess was right, the allFilters doesn’t initialize. I don’t get the Debug.Log statement.

Here is amore complete screenshot : http://prntscr.com/jmw3dk

Does your project use Gradle build system and maybe make use of Proguard?

Yep, i need the use of Gradle to keep using the Google Play Service. But nope, i don’t use Proguard.
Do i need to switch it back to internal ?