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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Issue connecting to the Internet from UWP

Discussion in 'VR' started by joshwhinkle, Mar 29, 2018.

  1. joshwhinkle

    joshwhinkle

    Joined:
    Mar 29, 2018
    Posts:
    1
    Hi. I'm a developer making Virtual Reality programs with Unity. I've been having some issues connecting to an online database when building for UWP so it can work with Windows Mixed Reality. Basically, what I'm trying to do is pull questions from an online JSON database which will the user will answer. However, with UWP we have issues pulling questions from the server. No other format, be it Oculus or OpenVR (which is compatible with WMR) has this issue. Does UWP have a certain issue with connecting to the Internet or interpreting JSON files?
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Have you enabled the internet servers in the publishing settings?
     
  3. jsoncpp

    jsoncpp

    Joined:
    Mar 9, 2018
    Posts:
    6
    Any updates on this? I'm having kind of a related problem where I'm getting some text from a server using UnityWebRequest. It works properly in Unity, however when running the program on HoloLens, it won't connect.
     
    Liut2018 likes this.
  4. ivan20071

    ivan20071

    Joined:
    Nov 15, 2017
    Posts:
    29
    Hi,
    with Unity 2017.3.1p1 I use UnityWebRequest setting chunkedTransfer to false and checking only the error property.
    Doing so It works even in Release build, otherwise it works only in debug buid.
     
    jsoncpp likes this.
  5. jsoncpp

    jsoncpp

    Joined:
    Mar 9, 2018
    Posts:
    6
    Hey, thank you for your reply! I just tried your solution and it worked. I am curious though about why
    Code (CSharp):
    1. (isNetworkError || isHttpError)
    is triggered in release build?
     
  6. RominaM

    RominaM

    Joined:
    Jan 16, 2019
    Posts:
    2
    Hi everyone,
    are there any updates on this topic?
    Because I am using Unity version 2018.3.0f2 and I have a similar problem with UnityWebRequest that I can't get solved right now.

    My setup:
    I want to release my application for the HoloLens and use UnityWebRequest to retrieve data from a database. In Unity there is no problem compiling and I can read the data as expected. But when I release the application in debug mode in Visual Studio for the HoloLens I get the following errors:
    (isNetworkError || isHttpError) = true
    error = Unknown Error
    Response Code = 0


    What I've been trying to do so far:
    chunkedTransfer = false
    (in Unity) Edit > Project Settings > Player Settings > Capabilities
    - Internet client,
    - Internet Client Server and
    - Private Network Client Server


    I have an internet connection with the HoloLens, because if I disconnect the device I get the error message "cannot resolve destination host".

    Any help in this area is very appreciated.
     
  7. RominaM

    RominaM

    Joined:
    Jan 16, 2019
    Posts:
    2
    For anyone dealing with the same issue:
    I can release my app on the HoloLens now, since I downgraded my Unity version to 2018.1.0f2. Then I could reproduce the error message that says "cannot resolve destination host" and I noticed a strange behavior: in Unity an http request can be sent if no "/" is set after the url, but on the HoloLens it does not work without the slash.
     
  8. MrSmokes

    MrSmokes

    Joined:
    Jun 13, 2017
    Posts:
    8
    having pretty much the same problem. Unity 2018.3.7f1

    in player settings > capabilities i have:
    enterprise authentication
    internet client
    internetclientserver
    privatenetworkclientserver
    all enabled.

    tried https://server.name/filename.json - works in editor, not on hololens (was working with http:// file hosted on private network with the above settings)
    https://server.name/filename.json/ (additional / on the end) hasn't resolved the issue and now causes errors in the editor (unexpected character while parsing path)

    changing https:// to http:// works within the editor, not within the HoloLens.

    *tears hair out*
    *sets HoloLens on fire*
     
  9. MrSmokes

    MrSmokes

    Joined:
    Jun 13, 2017
    Posts:
    8
    looks like it may have been a Microsoft problem, as after a software+firmware update to my dev HoloLens, it all started working.

    so for anyone else having issues loading public files to your HoloLens, make sure you've installed the latest updates before you set it on fire.
     
  10. khaleel671

    khaleel671

    Joined:
    Mar 29, 2019
    Posts:
    1
    I am facing the same problem.

    It works totally fine in Editor but not on Hololens. I have set all the capabilities but still I get the error "Cannot connect to destination host"

    Any other solution?
     
  11. upeter

    upeter

    Joined:
    Sep 13, 2018
    Posts:
    2
    I have the same problem. Does anyone know a solution for this?
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    Update your Unity version. This has been fixed in 2020.1.0a4, 2019.3.0b4, 2019.2.7f2 and 2018.4.10f1.
     
  13. Jake2012

    Jake2012

    Joined:
    Jan 15, 2020
    Posts:
    10
    I am having the same issues using UnityWebRequest on a HoloLens 2. I get the error of "Cannot resolve destination host". Was using Unity 2018.4.12 which was recommended by MS. Had upgraded to 2018.4.15, same problem. So, I need to downgrade to Unity 2018.4.10f1 to possibly fix this problem? So it looks like Unity developers did not merge in this fix with later releases so the UnityWebRequest problem continues with later releases within the 2018.4 branch?
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    No, you don't need to downgrade. "Cannot resolve destination host" is a different problem. Is that URL reachable from HoloLens via Edge? Have you enabled internet client capability in your manifest?
     
  15. Jake2012

    Jake2012

    Joined:
    Jan 15, 2020
    Posts:
    10
    The URL is reachable from the HoloLens via Edge (downloading a obj file, the text was displayed). I had enabled internet client capability through the Publishing Settings.
     
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    Can you check if the manifest in the generated VS project has that capability enabled?
     
  17. Jake2012

    Jake2012

    Joined:
    Jan 15, 2020
    Posts:
    10
    The manifest.json file under Packages does not have a internet capability listed. Does have com.unity.modules.unitywebrequest listed though. What would be the statement for adding internet capability directly to the manifest file?
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    Not the manifest file under Packages folder. I meant the AppX manifest file generated by Unity when you build to UWP (it's called package.appxmanifest I believe).
     
  19. Jake2012

    Jake2012

    Joined:
    Jan 15, 2020
    Posts:
    10
    Unity 2018.4.10f.1 Build -> AppxManifest.xml
    [I need to add the internet connection script and test to verify if this version works, I will update this thread once I verify]

    <Capabilities>
    <Capability Name="internetClient" />
    <uap2:Capability Name="spatialPerception" />
    <DeviceCapability Name="microphone" />
    </Capabilities>

    ============

    Unity 2018.4.12f1 Build -> AppxManifest.xml
    [Internet connection on the Hololens2 fails]

    <Capabilities>
    <uap2:Capability Name="spatialPerception" />
    </Capabilities>
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    Unity does not overwrite existing manifest. If you build on top of the previous build, capability player settings will not take effect.
     
  21. Jake2012

    Jake2012

    Joined:
    Jan 15, 2020
    Posts:
    10
    So if I change the capabilities during the development of a project, I should delete the contents of the App folder to force a new build? Or play it safe and always do the delete before a build?
     
  22. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,160
    The reason Unity doesn't delete it is because many people want to customize their app manifest. It's ok to continue building it on top, you just have to keep in mind that you'll have to modify the app manifest via Visual Studio if you want to make any changes to it.

    Building on top also is faster, because Unity doesn't have to rebuild all the files.
     
  23. Jake2012

    Jake2012

    Joined:
    Jan 15, 2020
    Posts:
    10
    Thank you for your help!
     
  24. joseGuate97

    joseGuate97

    Joined:
    Mar 1, 2018
    Posts:
    48
    I am using 2019.3.3f1. Should I update my Unity version?