immersivecognition / unity-experiment-framework

UXF - Framework for creating human behaviour experiments in Unity
https://immersivecognition.github.io/unity-experiment-framework/
MIT License
215 stars 41 forks source link

Add list element 'Settings to log' from script. #54

Closed thefirstfloor closed 3 years ago

thefirstfloor commented 3 years ago

Wiki "The Settings system allows researchers to pre-define parameters at the Session, Block or Trial level. These can be thought of as our independent variables. The settings to log is a list of settings that you wish to be recorded on each trial and added to the trial results output, specified using the Session component's inspector."

As far as I understand the docs, you can set a parameter on any level (block/trial) with settings.SetValue("exampleParameter", 100), but cannot find a way to make this setting then also automatically logged as a column in the trial.csv file. Only way seems to be then also add the 'exampleParameter' to the inspectors 'Data collection' tab. Or am I misunderstanding something?

jackbrookes commented 3 years ago

Yes that is the way to do it, type in the key name in this field.

You should also be able to add to this programmatically, if the key is variable:

string key = "exampleParameter";
session.settingsToLog.Add(key);

You could also store as a result, it would produce the same output:

session.CurrentTrial.result["exampleParameter"] = session.CurrentTrial.settings.GetInt("exampleParameter");
thefirstfloor commented 3 years ago

I prefer to define which settings are logged when setting up the session's sequence (based on the given settings), so before actually starting the session. When saving the output at end of trial, I then add the calculated outcomes as results. Feels more 'on point' that way.

I needed the session.settingsToLog.Add(key); to do that. Thanks!