x


Save/Load game using XML on Browser/Web Player

I am currently working on the ways to store the location and tags of the game objects online and trying to load them dynamically on calling them. I looked into this XML wiki - http://unifycommunity.com/wiki/index.php?title=Save_and_Load_from_XML and am using the JavaScript included there. The script works properly when I run it in the editor and also as a stand alone app. But it doesn't work on the browser. Should I rewrite the script to actually use WWW to load the xml file or am I doing something wrong? Am currently using the script with its File IO The Application.dataPath for some reason does not work with the web browser.

more ▼

asked Jul 19 '10 at 07:28 PM

diabloroxx gravatar image

diabloroxx
689 5 7 12

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

For all other new users who want to know what I did to use XML on web player-

I loaded the XML file using the WWW class to load the URL.

function LoadXML()
{
var url = "http://localhost/unity/sample.xml";
var www = new WWW(url);
while(!www.isDone)
{
yield WaitForSeconds(1);
}
yield www;
var _info : String = www.data;
_data=_info;
}

For writing back to the XML, I had to write a PHP file and called it using the WWWForm.

more ▼

answered Aug 02 '10 at 04:06 PM

diabloroxx gravatar image

diabloroxx
689 5 7 12

(comments are locked)
10|3000 characters needed characters left

You can't use local file I/O in the web player for security reasons.

more ▼

answered Jul 19 '10 at 07:39 PM

Eric5h5 gravatar image

Eric5h5
80k 41 131 518

Yeah. I figured that out. Are there any other methods to do this on the web player without using too much resource? All that I need to do is, get number of objects and the tags with location to display them on the screen. The user can modify location on screen though.

Jul 19 '10 at 08:02 PM diabloroxx

@diabloroxx: you can use the WWW class and get WWW.data.

Jul 19 '10 at 08:19 PM Eric5h5
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x810
x435
x434
x255
x126

asked: Jul 19 '10 at 07:28 PM

Seen: 6224 times

Last Updated: Jul 19 '10 at 07:28 PM