I am trying to use WWW to connect and download a text file from a web server however I keep getting this exception:
UriFormatException: Invalid URI: The format of the URI could not be determined.
MonoForks.System.Uri…ctor (System.String uriString, Boolean dontEscape)
MonoForks.System.Uri…ctor (System.String uriString)
(wrapper remoting-invoke-with-check) MonoForks.System.Uri:.ctor (string)
UnityEngine.UnityCrossDomainHelper.GetSecurityPolicy (System.String requesturi_string,
UnityEngine.UnityCrossDomainHelper.GetSecurityPolicy (System.String requesturi_string)
This only happens in any form of WebPlayer platform both inside and outside the editor however works perfectly fine when used in a standalone or IOS build. Following is the line that creates a new WWW request (dummy used for security).
WWW faqFile = new WWW(“http://127.127.127.127/faq_text.txt?p=” + (int)(Time.time * 1000));
Where the value on the end is to make sure it returns a new version of the file each time not a cached version, and the dummy ip replaces the original ip.
When the original URL is entered in a web browser I am able to access the file. There is no issues with permissions and no problems with crossdomain.xml.
This is all simply to do with the URI being used as far as I can tell.
Could anyone please shed some light on this issue?
The issue appears to be with the editor emulation of the webplayer. The webplayer appears to be accessing the data fine now. Is there any work-arounds for the editor? It’s kind of a pain to make a new build to test every change.
Thanks for all responses