I am stuck trying to figure out the path to my data file when I am dynamically creating my web page.
Has anyone done this?
The data file can not be in the same directory as the webpage so I have it in the www root directory, I am trying this with out success.
<param name="src" value="/Threshold.unity3d" />
<embed id="UnityEmbed" src="/Threshold.unity3d" width="1024" height="768" type="application/vnd.unity" pluginspage="http://www.unity3d.com/unity-web-player-2.x" />
<noembed>
The MIME settings are correct and the webplayer loads but it can not find the data file.
the application class offers various “src” variables containing such informations, also the dataPath one should work I think
if you mean in html: the path must be valid and http reachable so if your www root is not reachable it will not work or if it is behind a different domain you need to specify the full domain (in that case though keep in mind that you might run into security related things as the security is domain bound … unsure how it would work with such mixups exactly)
The src values for the “param” and “embed” tags below contains a valid and reachable http address as it is at the root of the website so “/Threshold.unity3d” is valid, but it doesn’t seem to be working.
The only way I am able to get it to work is to leave the .unity3d file in the same directory as the HTML file, but that doesn’t work in my scenario because this particular page is a dynamically generated page.
That’s why I wanted to leave the .unity3d file in the root of the website and access it by using the “/Threshold.unity3d” method or something similar.
Do you have any further suggestions?
Thank you for your help.
the problem is when /… is interpreted in the browser it represents something different than what you think.
you would need to use php to extract the relative path to your html and add that one in or if you know it, you can naturally also hardcode it.
But either way the path must either be absolute or relative to the html
It seems like my problem is I do not see why can’t I lay out something like this:
www/Folder1/test.html
www/Test.unity3d
Then set the path to the unity3d file relative to the html like this.
<param name="src" value="../Test.unity3d" />
<embed id="UnityEmbed" src="../Test.unity3d" width="1024" height="768" type="application/vnd.unity" pluginspage="http://www.unity3d.com/unity-web-player-2.x" />
This returns the same problem, even though the relative path is correct in this case.
and the player loads correctly if you enter it like that?
so somedomain.com/../Test.unity3d
where your html would be at somedomain.com ?
also if it is a IIS webhost, don’t forget that you must add the mime type for it to do anything at all.
The player loads, but “failed to download datafile” error in Google Chrome and “Invalid data file” in IE.
Haven’t tried specifying the full domain as that isn’t a “real good” solution for our needs as this site will be published under multiple faces (and therefore multiple skins/domains) and therefore the only solution there would be to programmatically determine the domain and sub-folder structure which is doable, but it just seems like I should be able to use either “/subfolder/unityfile.unity3d” or “…/unityfile.unity3d” either one as they are both valid paths and they are all working for the Flash content as well on my site.
We do have the IIS mime times working as we have verified this to work when the HTML/Unity file are in the same directory.
Once again, thank you for your continued support.
you can use any situation and setup that works with pure html too.
flash likely loads in the stuff differently but in unity anything you specify is download through the browsers http connection so as long as you comply to those requirements and restrictions its fine.
but if it doesn’t then it will not work.
and full domain actually sounds exactly like what you want in this case cause it would be the same for all your “skins”
Either that or use a folder hierarchy opted for it or naturally have a php generate the path, not statically setting it
Thanks again.
It seems like the webplayer does not do path conversion the way a browser does.
It looks like I will have to hard code the full path to the .unity3d file.
Well that does not work, I tried.
<param name="src" value="http://mysite.com/Threshold.unity3d" />
<embed id="UnityEmbed" src="http://mysite.com/Threshold.unity3d" width="1024" height="768" type="application/vnd.unity"
and the webplayer still can not find the .unity3d file even thought its a valid path and I can download the file from there.
Can the webplayer not load a file that is not in the exact same path for some reason?