In preparing for the deployment of the very first beta of the next game as a webplayer, I’ve run into a few troubles with webplayer security policies, so here’s how to do it right so it will work in the Editor and in the webplayer:
In Edit>Project Settings>Editor enter the location where your final webplayer file will be deployed.
Create a crossdomain.xml file as described here in the docs
(Now comes the part where I went wrong) The unity docs only give the following example:
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
Now this allows access from any domain, what if you want to restrict it? My mistake was to include http:// with the domain, here’s an example that works:
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="beta.blackish.at"/>
<allow-access-from domain="*.blackish-games.com"/>
</cross-domain-policy>
More info available in the Adobe CrossDomain Policy File Specifications
The crossdomain.xml file has to be placed at the root of your server and I haven’t found a way to access a subdomain yet. If you know how to do that, please let me know!