Can the web player streamed access the data from txt file ??

Hello ,guys.

I build a project with the web player streamed , but the web built can not access the data from the txt files.However ,if I build it with window standalone , it just works well. What is going wrong? what shall I do to solve the problem? Does the WWW class could solve it?

I’m guessing that you are trying to use the System.IO.File read methods which are not available in the web player due to security reasons. Yes, use the WWW class and read the text data from the deployed website.

yes it can. but the txt must be on the web or same domain too.
if its somewhere else you must have a crossdomain configuration file at its place or you can’t access it

God , that will bring me a lot of trouble . I need to create a website??

you don’t need “a website” but a place where you put it on the web. any such place you can access through http is normally called website.

if you don’t want it to be on a web, don’t use webplayer build but standalone windows or osx

And what do you mean by “crossdomain configuration file” ? What is special? How to make the web player access the local txt files without using the website? Is that kind of player just for accessing the data from website?

a webplayer can not access the harddisk anywhere but its own folder and it can only read, you can NOT write data there at all.

check out the manual on the sandbox in the 3.0 webplayer (pretty bottom in the listing of the manual) to read more on the crossdomain stuff.
but even with crossdomain: you can not write to the harddisk of the computer in any way.

em,maybe I have to change my plan now. I am using flash file to execute the standalone windows , but it can not work.

assuming I understood you right: flash ↔ unity communication normally goes through JS on the website or tcp connection between the two. I’m not aware of other ways.

but sounds all very strange and I?m sure you are trying to do something 10 times more complicated than needed

Thank you , I have to turn to other method.

How to read files at own folder?

by just opening files through relative path as any html would do.

and own folder means you have downloaded the whole webplayer, its html etc to harddisk prior starting or it won’t work either

czx_main:
building WebPlayer? Unity - Scripting API: WWW
desktop game? File Class (System.IO) | Microsoft Learn

WWW can not use file:// in a general manner on the webplayer

I am not sure I got it right.

Say I in dropbox I will put in the same directory the webplayer and .obj file. Can I in princple read the .obj from the running webplayer?
Thanks

if your code is right, it should technically work yes, but you can not use System.IO etc to read as any port io / file io is disabled.

I see , thanks

I know it can’t, I’m just saying if you’re using the WebPlayer, all you really got is the WWW and its limitations. And if you’re using a standalone game then you would use System.IO.

Can somebaody please post an example of using WWW to load an xml file with the webplayer?
Can’t get it to work. Is this possible?

Look at the example code on the WWW class that tells you how to download something in general.
there you would then put the url to the xml on the web, either as relative path or on a domain with crossdomain.xml configuration setup.

after you ahve done that you use www.text to generate the desired xml object from this string, you can not use any xml functionality that expects a file