I try to use WWW class and a relative path to load a local assetbundle on a web player.
WWW www = new WWW("./WebPlayer/BigTree.unity3d");
The error message I got is "Rejected because no crossdomain.xml policy file was found."
The relative path should be correct because I can normally run my program on some computers. However, I got this error message on few computers.
I am wondering that if I can load a assetbundle locally ? If I can do it, do I use the right way to do it ? Does WWW class always use socket to load files even if the file is in a local file system ?
My OS is Windows XP, and the web player version is 3.4.1f5. In addition, when I got this error message, the Application.dataPath is "file:/". I am not sure if this is relevant to this problem, but I try to give as much information as I can.
Answer by Graham Dunnett
May 07, 2013 at 08:42 PM
You need to give the full URL including the http and server host. Relative URNs are not supported. The webplayer has no access to the file system of the client where it is running. You should not expect to be able to load asset bundles from the file:// protocol. Application.dataPath is returning file:// presumably because you are launching the webplayer using an html document on your computer. Asset bundles can only be fetched from webservers. The doc page for asset bundles shows how to load them in the editor if you are testing them.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
13 People are following this question.
PC build cant download assetbundle from server
Crossdomain.xml, same server but i get 'Rejected' error ...
How to import the object from server to unity
Download assetbundles with Webapp
How can I remotely update my customers game scripts?