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. Dismiss Notice

Unity 2017.1f3 - UriFormatException: Invalid URI: The hostname could not be parsed. ( G:)

Discussion in 'Editor & General Support' started by sama-van, Jul 12, 2017.

  1. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    Hi!

    Having an issue with the last Unity release.
    The project has been running well for a half year, never had any problem on this before.
    Error seems to be directly on the StartCoroutine, which is pretty weird.... o_O...

    Below code sample + error :)

    Code (csharp):
    1.  
    2.         public void LoadMask()
    3.         {
    4.             if (File.Exists (textureFileMask))
    5.             {
    6.                 Debug.Log ("textureFileMask = " + textureFileMask);
    7.                 StartCoroutine ("RunLoadMask", textureFileMask);
    8.             }
    9.         }
    10.  
    Code (csharp):
    1.  
    2. textureFileMask = G:/unity-Snap-Editor/_Build/_res/photo/Fragmentation_S4_back-MASK.png
    3.  
    Code (csharp):
    1.  
    2. UriFormatException: Invalid URI: The hostname could not be parsed. ( G:)
    3. System.Uri.Parse (UriKind kind, System.String uriString)
    4. System.Uri.ParseUri (UriKind kind)
    5. System.Uri..ctor (System.String uriString, Boolean dontEscape)
    6. System.Uri..ctor (System.String uriString)
    7. UnityEngineInternal.WebRequestUtils.MakeInitialUrl (System.String targetUrl, System.String localUrl) (at C:/buildslave/unity/build/Runtime/WebRequest/Managed/WebRequestUtils.cs:481)
    8. UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    9.  
     
  2. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    I am sorry but any update on this?
    No solution also on our side too. :(
     
  3. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    Are you using www??if you want access to hard disk(not internet)write by example:
    String mypath = "file:///c:/mydocument.txt".you must use the file:/// protocol to access to disk.File.exist not require file:/// protocol
     
  4. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
  5. kerem-yokuva

    kerem-yokuva

    Joined:
    Nov 21, 2015
    Posts:
    10
    I am having the same problem with http calls to playfab.com.

    UriFormatException: Invalid URI: The hostname could not be parsed. (.playfabapi.com)
     
  6. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    Yeah as I said the project (actually big one) is working well, only the version 2017.1 report this error.
    I use the www thing this way as always when it comes of local datas :

    Code (csharp):
    1.  
    2. IEnumerator LoadLocalData(string path)
    3.         {
    4.      Debug.Log (path);
    5.             WWW www = new WWW("file:// " + path);
    6.             yield return www;
    7.  

    Actually reading your code, I only use "//" and not "///". gonna have it a try o_O.
     
  7. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    Your code is ok.it was a writting error.

    File:// is ok.

    In your code:
    1. textureFileMask = G:/unity-Snap-Editor/_Build/_res/photo/Fragmentation_S4_back-MASK.png
    Where are the ""?
    textureFileMask = "G:/unity-Snap-Editor/_Build/_res/photo/Fragmentation_S4_back-MASK.png";
     
  8. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    Its from a Debug.Log().
    Using the StartCoroutine for the past 6-7 years dude, never had a problem as the one mentionned.


    Still no feedback and fix yet... can't upgrade Unity =_=#
     
  9. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    Take the url and paste in explorer with file://.Can you see something?
     
  10. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    Alright!!

    From an empty project : 1 small script, a texture, a scene.

    Write the path of the texture in the FilePath slot, then press play.

    Below the ZIP file with the project.
    a screenshot from 2017 and the error.
    a screenshot from 5.6.1f1 from the same project and texture loaded without problem

    Cheers :)
     

    Attached Files:

  11. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    Samma I can see a space after file://.Try removing this space.
     
  12. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    I am going to test your proyect.I say you something in a few minuts.Wait please
     
  13. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
  14. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    I have not error in unity 5.6.2f1
     
  15. jviruss

    jviruss

    Joined:
    Oct 4, 2016
    Posts:
    48
    What version of unity do you have?Try to update to 5.6.2f1.Are you sure that you have folder permissions to access in this folder???
     
  16. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    as I said , no error on Unity 5.6.x

    You should download the last release called Unity 20171.0.
    https://unity3d.com/get-unity/download/archive
     
  17. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
  18. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    there were actually really an empty space... =_=....
    Unbelievable ahahah!
    Sorry for the wrong alert :)
     

    Attached Files:

  19. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,875
    www remark: in Windows StandAlone and Windows Store Applications you should use file:/// (3 slashes) whereas on other platforms file:// (2 slashes) must be used. Seems Unity 2017.1 is stricter.