You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-26Lines changed: 25 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,14 @@
1
1

2
2
3
3
# UXF - Unity Experiment Framework
4
-
A set of C# scripts which simplifies management of human-based experiments developed in Unity. This is the development project, if you want to download the package, see [Releases](https://github.com/jackbrookes/unity-experiment-manager/releases).
4
+
A set of C# scripts which simplifies management of human-based experiments developed in Unity. This is the development project, if you want to download the package, see [Releases](https://github.com/jackbrookes/unity-experiment-framework/releases).
5
+
6
+
## Get started
7
+
8
+
Import the latest ```.unitypackage```[release](https://github.com/jackbrookes/unity-experiment-framework/releases) to your existing Unity project.
9
+
10
+
Note: Users must change API Compatibility Level to .NET 2.0 in Unity player settings.
11
+
5
12
6
13
## Features
7
14
@@ -47,23 +54,22 @@ UXF classes will be useful in two main parts of your project:
47
54
```csharp
48
55
classExperimentBuilder : Monobehaviour
49
56
{
50
-
// set this to your ExperimentSession instance in the inspector
51
-
publicExpMngr.ExperimentSessionsession;
57
+
// set this to your Session instance in the inspector
58
+
publicUXF.Sessionsession;
52
59
53
-
// call this function from ExperimentSession OnSessionBegin UnityEvent in its inspector
54
-
publicvoidGenerateAndRun()
55
-
{
56
-
// Creating a block
57
-
varmyBlock=newExpMngr.Block(session);
58
-
59
-
// Creating 10 trials within our block
60
-
for (inti=0; i<10; i++)
61
-
newExpMngr.Trial(myBlock);
60
+
// assign this method to the Session OnSessionBegin UnityEvent in its inspector
61
+
publicvoidGenerateAndRun(UXF.Sessionsession)
62
+
{
63
+
// Creating a block of 10 trials
64
+
varmyBlock=session.CreateBlock(10);
62
65
63
66
// Add a new setting to trial 1, here just as an example we will apply a setting of "color" "red"
64
-
varfirstTrial=myBlock.GetTrial(1);//trial number is not 0 indexed
67
+
varfirstTrial=myBlock.GetTrial(1);//trial number is not 0 indexed
65
68
firstTrial.settings["color"] ="red";
66
69
70
+
// Save session instance reference
71
+
this.session=session;
72
+
67
73
// Run first trial
68
74
session.nextTrial.Begin();
69
75
}
@@ -79,11 +85,12 @@ class ExperimentBuilder : Monobehaviour
79
85
```csharp
80
86
classSceneManipulator : MonoBehaviour
81
87
{
82
-
// set this to your ExperimentSession instance in the inspector
83
-
public ExpMngr.ExperimentSessionsession;
88
+
public UXF.Sessionsession;
84
89
85
-
// call this function from ExperimentSession OnTrialBegin UnityEvent in its inspector
86
-
publicvoidRunTrial(ExpMngr.Trialtrial)
90
+
...
91
+
92
+
// assign this method to the Session OnTrialBegin UnityEvent in its inspector
@@ -93,7 +100,7 @@ class SceneManipulator : MonoBehaviour
93
100
}
94
101
95
102
// this could trigger on some user behaviour, collecting their score in a task
96
-
publicvoidEndTrial(intscore)
103
+
publicvoidRecordResultsAndEnd(intscore)
97
104
{
98
105
// store their score
99
106
session.currentTrial.results["score"] =score;
@@ -108,14 +115,6 @@ class SceneManipulator : MonoBehaviour
108
115
See `Assets/ExpMngr/ExampleScript.cs` for another simple example.
109
116
110
117
111
-
112
-
## Get started
113
-
114
-
Download the project folder and open in Unity. Alternatively import the latest ```.unitypackage```[release](https://github.com/jackbrookes/unity-experiment-manager/releases) to your existing Unity project.
115
-
116
-
Note: Users must change API Compatibility Level to .NET 2.0 in Unity player settings.
0 commit comments