yasirkula / UnitySimpleFileBrowser

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

File Access does not work on quest 2 #87

Closed thmasn closed 9 months ago

thmasn commented 9 months ago

it seems to be i am the first one trying to use the file browser on a quest 2!

Description of the bug

File Access on the quest 2 seems to be limited to the apllications own folder. everything works perfectly in the application folder which is opened by default. but, even after granting rights to another folder to the application, only the application folder is shown. no new quick links appear on the left side of the file browser, no other files are visible in the right side item view.

Reproduction steps

Platform specs

Additional info

no errors in logcat. i did add custom debug logs, which tell me: in FetchPersistedSAFQuickLinks(), resultRaw is always "0", which causes the function to return. my guess is that this is the cause of no quick links appearing. why is it zero? i do not know...

yasirkula commented 9 months ago

Can you try running this code in Awake/Start:

#if !UNITY_EDITOR && UNITY_ANDROID
typeof(SimpleFileBrowser.FileBrowserHelpers).GetField("m_shouldUseSAF", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, (bool?)false);
#endif
thmasn commented 9 months ago

i had to add "using System.Reflection;" and added the code to the beginning of Awake()

now it works perfectly, i can even see all the folders on the device!

i have no idea why it works, but thank you a lot for the help!

yasirkula commented 9 months ago

You're welcome. I don't know why it works either, I've just stopped asking myself this question some time ago 🙈