yasirkula / UnitySimpleFileBrowser

A uGUI based runtime file browser for Unity 3D (draggable and resizable)
MIT License
851 stars 111 forks source link

don´t return nothing on load button clicked #28

Closed frere97 closed 3 years ago

frere97 commented 3 years ago

using the base code i can't pass from "yield return FileBrowser.WaitForLoadDialog( false, true, null, "Load File", "Load" );", not even the debug return a message, i'm using the version in the asset store

yasirkula commented 3 years ago

Can I see your coroutine? And make sure to call your coroutine with StartCoroutine.

frere97 commented 3 years ago

IEnumerator ShowLoadDialogCoroutine() { // Show a load file dialog and wait for a response from user // Load file/folder: file, Allow multiple selection: true // Initial path: default (Documents), Title: "Load File", submit button text: "Load" yield return FileBrowser.WaitForLoadDialog( false, true, null, "Load File", "Load" );

    // Dialog is closed
    // Print whether the user has selected some files/folders or cancelled the operation (FileBrowser.Success)
    Debug.Log( FileBrowser.Success );

    if( FileBrowser.Success )
    {
        // Print paths of the selected files (FileBrowser.Result) (null, if FileBrowser.Success is false)
        for( int i = 0; i < FileBrowser.Result.Length; i++ )
            Debug.Log( FileBrowser.Result[i] );

        // Read the bytes of the first file via FileBrowserHelpers
        // Contrary to File.ReadAllBytes, this function works on Android 10+, as well
        byte[] bytes = FileBrowserHelpers.ReadBytesFromFile( FileBrowser.Result[0] );
    }
}
frere97 commented 3 years ago

it is the one u use in your github example

yasirkula commented 3 years ago

You are calling it using StartCoroutine( ShowLoadDialogCoroutine() ); and not just ShowLoadDialogCoroutine();, am I right?

frere97 commented 3 years ago

yes StartCoroutine( ShowLoadDialogCoroutine() );

frere97 commented 3 years ago

i've putted a debbug before and after the return, and just the one before was called

yasirkula commented 3 years ago

This is weird. Are there absolutely no error messages in console? Does the file browser show up properly? Does the log still not show up after closing the dialog?

frere97 commented 3 years ago

the only error that appears is referent for Vr because the window closes, but the vr is still trying to hit a canvas (but i´ve tried in onverlay, the erro does not appears, and i still does not get the message), the window display correctly and the log still does not shows up after closing the window

yasirkula commented 3 years ago

On which Unity version does this occur? Can I see your complete script so that I can just copy&paste it on my Unity editor and test it?

frere97 commented 3 years ago

2019.4.01f1, it used to work, some weeks ago, but when i reimported the project it broked, the script is the one u provide in the homepage with the name of "example code". i will try something idiot that i should had tried a time ago, restart unity XD

frere97 commented 3 years ago

yeah, reloading unity didn't worked

yasirkula commented 3 years ago

I've copy&pasted the example script to my 2019.4.0f1 project. I can see the logs without any issues:

ss

I'd recommend you to create a fresh new project, import the plugin there and see what happens. It will work because it works on my Unity project lol. Then, you need to figure out what's going on with your actual project.

frere97 commented 3 years ago

thanks man XD, i will try to figure out what's happening, if i got something i update in here

frere97 commented 3 years ago

i created a project from zero, and this still does not works XD

frere97 commented 3 years ago

probably is the computer of my work that is blocking the app from exploring and oppening the archive

yasirkula commented 3 years ago

If you press Cancel, a "False" log must be printed to console, no matter what. I don't know why this isn't the case for you but I could clearly see the logs in my empty project, so I'm closing this Issue :/

frere97 commented 3 years ago

the problem was me beeing dumb XD

i was putting the prefab in scene and the script to handler him together, so, when the object was beeing deactivated, the script stopped. sorry for making u loose your time

yasirkula commented 3 years ago

Happy to hear that the issue is resolved :)