yasirkula / UnitySimpleFileBrowser

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

QuickLinks initialised before permission grant on Android #18

Closed Chadys closed 4 years ago

Chadys commented 4 years ago

Hello, first of all I love your asset and thank you for opensourcing it. I think I discovered a little bug.

On Android, you need to ask for the READ_EXTERNAL_STORAGE permission to access, for example, the content of an external SD card. But, in FileBrowser.cs L.492, you call InitializeQuickLinks in the Awake function, before the user is asked for the permission to read files. Which means that the external SD card you may have, won't appear in the QuickLinks of the SimpleFileBrowserCanvas, even if the permission to access it has been given afterwards.

The bug is not blocking, since on all following app launches, if you don't revoke the permission of the app, you won't ever see it anymore. But it still would be better if it also worked the first time.

yasirkula commented 4 years ago

You are right! Pushing a fix now.

Chadys commented 4 years ago

Wow that's quick! There is still a problem however. I'm working on VR, using Wave SDK. Using that, you can't use the standard permission dialog, you need to use the one of the SDK. If RequestPermission is called on that platform, you'll get an app freeze since the dialog won't be visible. Your fix has two problems:

A better solution might be to call InitializeQuickLinks in the Show function, after the permission check, if it hasn't yet been initialised ?