|
I'm designing a virtual navigation experiment, and i was wondering if i could somehow automatize my work. I need to present the same scene again and again, every presentation consists of adjusting player position first, than navigation, than if the subject says ready, save his position. So i thought about that maybe an algorithm could do it. The pure algorithm is something similar: Load player position Let the player move the avatar Waiting for the subject to press ready Save position Do it again (approximately 20 times) Could you help me out? Agoston Torok, HAS, Institute of Psychology
(comments are locked)
|
|
Unity has a very simple built-in method of saving small amounts of data to the local machine using the PlayerPrefs class, which saves you from having to deal with explicitly reading and writing files. For example:
And the commands are very similar for floats and strings:
You could use this to write the x,y,z values of the player position and rotation. You can also query the player prefs data to see whether a certain key has been set, using PlayerPrefs.HasKey, and delete keys using either PlayerPrefs.DeleteKey or PlayerPrefs.DeleteAll. PlayerPrefs is only small amounts of data if you're using the web player, in which case it's 1MB. Otherwise there are no limits. But yes, this is generally preferable to using http://System.IO since it's automatically cross-platform, and easier to deal with.
Feb 10 '10 at 09:52 AM
Eric5h5
I figured for psychology experiments you usually want everything in text files at the end to convert to Excel and lateron convert to statistical software for analysis. So I went for text files and http://System.IO. Not sure how the process with PlayerPrefs would be.
Feb 10 '10 at 06:54 PM
Sebas
Sure, if you want to create files in a format for other apps to read, using FileIO makes more sense. Using playerprefs only makes sense if the data is relatively small, and only needs to be read back by the unity file which wrote it.
Feb 10 '10 at 09:30 PM
duck ♦♦
(comments are locked)
|
|
Sounds very similar to my work (also psychology with focus on navigation). I load and save all my data from text files using streamwriter link. Should look something like this.
Load and save your positions in a textfile. So basically, load player position, set his transform accordingly, enable him walking through the environment and when he clicks or reaches his destination, just save and repeat the whole process. If you need more details, I am basically doing something very similar. Drop me an email with what you do for your research (sebastian DOT koenig AT canterbury DOT ac DOT nz). I've written you an email.
Feb 11 '10 at 07:48 PM
Agoston Torok
By the way, I utilized your script above in my experimental task and it works beautifully. Thank you!
Sep 16 '10 at 04:01 AM
Neuropsyched
(comments are locked)
|
|
This is probably a dead thread but I just started in on using Unity for my experiments and wanted to talk to a few fellow psychologists about their experiences. I just finished working up a reaction time experiment I'll be implementing on the iPad and am concerned about the accuracy of the times that are generated. I did a very VERY low tech check by comparing the Unity generated times with those of a stopwatch and the times seemed to check out. Specifically, the events in Unity and the stopwatch were started at about the same time and basically matched (assuming that the .04 second difference was due to human error in the synchronization). What are your experiences with RT? Feel free to contact me at dgs45 AT drexel DOT edu
(comments are locked)
|
|
Thanks to you I'm using the streamwriter, hope that this would work. And as you mentioned i prefer text files as output for further statistics, so the PlayerPrefs wouldn't be enough. I feel, that it needs some hours/days to finish it, but i will inform you about the progress os success. Thank you all! Agoston Torok
(comments are locked)
|
|
Problem solved, it's working very well. Thank you very much! Please accept the correct answer :)
Mar 30 '10 at 09:18 AM
KvanteTore
(comments are locked)
|
