- Home /
How do I save and retrieve ordered data? Can I do this with an array?
I am creating a virtual environment for a neuroscience experiment. Participants will need to navigate to stores within this virtual environment so that they can deliver items. They will later need to remember which stores they visited in what order. Therefore, I need to store data on the order in which subjects visited the stores. I was thinking that I could save the list of stores they visited in an array, but I'm very new to scripting and am not coming up with a solution. Any help would be appreciated!
well, you can do this with PlayerPrefs. you let the participants to enter a nickname maybe, you would store these in a format like this; nickname + storeorder + storenumber. to work with arrays the following is useful; http://wiki.unity3d.com/index.php/ArrayPrefs2 for this, you would be storing an array of vector3, participant nr, store order, store number etc... good luck.
You might take a look at ArrayPrefs2 in the Unity Wiki:
http://wiki.unity3d.com/index.php/ArrayPrefs2
It is built on top of PlayerPrefs and gives you an easy way to save arrays of basic types.
Answer by rockyourteeth · Apr 21, 2014 at 09:52 PM
Generic lists are ordered. So you can add each one to the list as you go using:
myList.Add(onePieceOfDataToAdd);
and then, when you're done, you can start going through them from first to last using a for loop or foreach loop.
Your answer
Follow this Question
Related Questions
Strategy for saving game 1 Answer
Saving or get array of string - PlayerPrefs 0 Answers
Save and Load Function 2 Answers
Best method to save a multi-dimensional array as a file? 1 Answer
A node in a childnode? 1 Answer