- Home /
Using WWW class locally (webplayer)
I'm trying to load AssetBundles with the WWW class.
In the editor I don't have any issues but when I build the game in webplayer the www object can't load my resource and throw me this error :
"Rejected because no crossdomain.xml policy file was found"
I tried to add an crossdomain.xml with the basic generic allow syntax near the html page (same folder)
But nothing.
Any ideas for how to make the WWW class work in a file:/// context ?
Many thanks !
is this literally deployed on your computer? Is it hosted? Are you using the file:/// with a fully qualified path? You do realize that you're trying to break the sand boxing of your browser and also consider, if you were able to do this, couldn't you just post a webplayer build and try and snake files from any computer and stuff it away? That isn't to say you couldn't request a file location through normal dialogs and javascript through browser communication and unity. Consider what you're asking the webplayer, hosted in a browser to actually do security wise.
I understand that this is touchy security wise but I thought that there would be a way to bypass that in a local -on my own computer- context. $$anonymous$$aybe I'll just use System.IO for debuging and WWW for release.
Thanks for the time ;) !
But I can't find how to load assetbundle through System.IO :)
Yup, read that one already. Doesn't work in my case. Application.dataPath contains "file://" and if you don't use "http://" with a local webserver it won't work.
Answer by abi-kr01 · Feb 28, 2015 at 08:05 AM
you can go to your edit->project seatings->editor and in the host url give your url as http://127.0.0.1 and testit
Tried it. 127.0.0.1 only works if you have a local webserver.
just replace with your site name like "http://answers.unity3d.com/" then it will work from everywhere
I'm guessing you don't suggest to literally write "http://answers.unity3d.com/" in my file path ? I don't have a website. I work locally :)
But as Landern said it's a matter of security. It's impossible to do what I want to do. I'm currently using a local webserver (wamp server) to simulate the online part.