File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ public class ExperimentSession : MonoBehaviour
29
29
30
30
[ Header ( "Data logging" ) ]
31
31
// serialzed private + public getter trick allows setting in inspector without being publicly settable
32
- [ SerializeField ] private List < Tracker > _trackedObjects = new List < Tracker > ( ) ;
32
+ [ SerializeField ]
33
+ private List < Tracker > _trackedObjects = new List < Tracker > ( ) ;
33
34
/// <summary>
34
35
/// List of tracked objects. Add a tracker to a gameobject and set it here to track position and rotation of the object.
35
36
/// </summary>
@@ -65,6 +66,12 @@ public class ExperimentSession : MonoBehaviour
65
66
66
67
bool hasInitialised = false ;
67
68
69
+ /// <summary>
70
+ /// True when session is attempting to quit.
71
+ /// </summary>
72
+ [ HideInInspector ]
73
+ public bool isQuitting = false ;
74
+
68
75
/// <summary>
69
76
/// Settings for the experiment. These are automatically loaded from file on initialisation of the session.
70
77
/// </summary>
@@ -417,10 +424,12 @@ public void EndExperiment()
417
424
{
418
425
if ( hasInitialised )
419
426
{
427
+ isQuitting = true ;
420
428
if ( inTrial )
421
429
currentTrial . End ( ) ;
422
430
SaveResults ( ) ;
423
431
fileIOManager . Manage ( new System . Action ( fileIOManager . Quit ) ) ;
432
+ isQuitting = false ;
424
433
}
425
434
}
426
435
@@ -429,7 +438,7 @@ void SaveResults()
429
438
List < OrderedResultDict > results = trials . Select ( t => t . result ) . ToList ( ) ;
430
439
string fileName = "trial_results.csv" ;
431
440
string filePath = Path . Combine ( sessionPath , fileName ) ;
432
-
441
+
433
442
// in this case, write in main thread to block aborting
434
443
fileIOManager . WriteTrials ( results , filePath ) ;
435
444
}
You can’t perform that action at this time.
0 commit comments