how to save scores in external file?

hi, please give me examples how to save scores in external file such as .txt or .xml. Is this posible in javascript?

If you want to use XML, the classes for doing that is in the System.Xml namespace, as documented here:

You’ll find many examples on the net, such as this one here:

It’s in C#, but JS should be pretty much the same.

There is very big code :shock: I can’t anderstand this. Can anybody give me simple example in javascript? :wink:
I think it’ll be more simple to do this in .txt file.

Actually, if you just want to save some simple high scores, you don’t have to care about parsing XML - you can use Unity’s built in PlayerPrefs class instead.

See Unity - Scripting API: PlayerPrefs

Saving high scores could then look something like this:

for (i=0;i<10;i++)
{
PlayerPrefs.SetInt("Score"+i, scores[i]);
PlayerPrefs.SetString("Name"+i, names[i]);
}

I want to save scores for each players