Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question access to oculus 2 local video/images from unity

Discussion in 'VR' started by RedSkyLine, May 10, 2023.

  1. RedSkyLine

    RedSkyLine

    Joined:
    Nov 30, 2020
    Posts:
    2
    hello, i want to ask how can i access to some videos and image url which are located in my oculus 2 local storage to use them in unity, i used to access by url /sdcard/Android/../../...mp4 but its not working anymore
     
  2. CMaster_Thomas

    CMaster_Thomas

    Joined:
    Jan 13, 2020
    Posts:
    5
    having the same issue at the moment, worked fine before
     
  3. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    486
    This is because the Quest OS v53 now uses Android 12, which limits the way apps can access storage. From the developers of Polysketch:

    - No Access
    --- /sdcard/Polysketch/
    - Can create folders, but not files
    --- /sdcard/Android/Polysketch/
    - Full folder & file creation
    --- /sdcard/Andoird/Android/data/com.PolysketchLLC.Polysketch/files (Application.persistentDataPath)
    --- /sdcard/Download/Polysketch/ ----- not very safe as users will arbitrarily delete-all here if running out of space
    --- /sdcard/Documents/Polysketch/ ----- seems like the best option. Easy user access, and we can read each other's save locations if we wish to.

    How to update -
    Setting the flag preserveLegacyExternalStorage to true in the manifest will allow you to read & write from sdcard/whatever/ if the app is installed as an update to an older version. On clean installs, this flag is ignored. So this flag won't grant us access indefinitely, but will let us read old save files and move them to the new preferred spot. AndroidManifest.xml <application android:requestLegacyExternalStorage="true" android:preserveLegacyExternalStorage="true">
     
    mgear likes this.
  4. RedSkyLine

    RedSkyLine

    Joined:
    Nov 30, 2020
    Posts:
    2
    h
    hello sir thanks for responding, I didn't quit understood how to fix it, i've added android reserveLegacyExternalStorage="true" to the manifest but I couldn"t build the project
     

    Attached Files:

  5. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    486
    My post above shows which locations are allowed to access, namely either Application.persistentDataPath, Downloads, or Documents. You can get these folders like this:

    Code (csharp):
    1. AndroidJavaObject downloadFolder = environment.CallStatic<AndroidJavaObject>("getExternalStoragePublicDirectory", environment.GetStatic<AndroidJavaObject>("DIRECTORY_DOWNLOADS"));
    2. string folderPath = downloadFolder.Call<string>("getAbsolutePath");