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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

URL Path to view images from a shared folder in windows on Android device.

Discussion in 'Android' started by gigolv, Mar 27, 2019.

  1. gigolv

    gigolv

    Joined:
    Sep 30, 2017
    Posts:
    6
    Im trying to do a browser for images in an Android device.

    Have been able to get an image for a texture using the UnityWebRequest.GetTexture(url); command and it seems to be working when using local files or images stored on the app Asstes folder, but havent been able to point it to images stored in a shared folder on the same network from a PC.

    I have been able to view the images using the ES File Explorer app and connecting it to a LAN folder, but that is outside my app in Unity.

    Does anybody know how to construct the path for the URL that the UnityWebRequest.GetTexture(url) requires?

    So far, I understand I shoud be using the "File://" protocol but havent been able to connected the following path:

    "\\design\classroom\exampleImage\design.jpg". The computer "design" on my network has a shared folder called "classroom" and a sub folder calles "exampleImage", which in turn contains the image for the Texture to be used for my RawImage Object in the app.

    I have also tried to include a file browser from the asset store, which on turn returns the path for the images when viewing local folders either on my pc or on my phone, but havent been able to view or get the path for the shared folder on the "design" pc on my network.

    Thanks for any suggestions, I greatly appreciate it.
     
    Last edited: Mar 28, 2019
    achimmihca likes this.
  2. OyvindE

    OyvindE

    Joined:
    Feb 1, 2018
    Posts:
    8
    I have the same problem. Have you found any solution yet?
     
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,653
    I don't think it's about the path, it's about permissions for app to access those files.
     
  4. gigolv

    gigolv

    Joined:
    Sep 30, 2017
    Posts:
    6
    I´ve already specified the read and write permissions from the app and managed to connect to the shared folder using Es FileExplorer, but haven't been able to specify the proper path from within UNITY...

    if I find the answer Ill let you know...
     
    achimmihca likes this.
  5. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    > I managed to connect to the shared folder using Es FileExplorer, but haven't been able to specify the proper path from within UNITY

    Same here. Did you find a way to read a shared network folder from Unity Android?
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,653
    You mean access Windows shared folder from Android device?
    I'm not sure this is supported. But you can try making an smb:// uri for it. The file:// uri on Android I believe only supports local files, but I don't remember is samba protocol is enabled there or not. Worth to try though.
     
  7. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    Seems like samba protocol is not enabled.

    I tested it and get an error (copied from Android Logcat):
    Code (CSharp):
    1. 2022.12.19 15:53:30.247 27431 27525 Error Unity Curl error 1: Protocol "smb" not supported or disabled in libcurl
    Tested with
    Code (CSharp):
    1. UnityWebRequestTexture.GetTexture(new Uri("smb://AAS-LAPTOP/Users/andre/Downloads/NetTest/cover.jpg"))
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,653
    Yes, the error means it is not available. We only enable a certain set of protocols to make player size smaller. Also, samba protocol has little uses on Android besides local development. And even for that it's probably simpler to setup an HTTP server to serve filers, than deal with different Windows vs. the rest uris.