Skip to content

Commit f50ed5e

Browse files
committed
added isquitting varaible
1 parent 429416b commit f50ed5e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Assets/ExpMngr/Scripts/ExperimentSession.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public class ExperimentSession : MonoBehaviour
2929

3030
[Header("Data logging")]
3131
// 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>();
3334
/// <summary>
3435
/// List of tracked objects. Add a tracker to a gameobject and set it here to track position and rotation of the object.
3536
/// </summary>
@@ -65,6 +66,12 @@ public class ExperimentSession : MonoBehaviour
6566

6667
bool hasInitialised = false;
6768

69+
/// <summary>
70+
/// True when session is attempting to quit.
71+
/// </summary>
72+
[HideInInspector]
73+
public bool isQuitting = false;
74+
6875
/// <summary>
6976
/// Settings for the experiment. These are automatically loaded from file on initialisation of the session.
7077
/// </summary>
@@ -417,10 +424,12 @@ public void EndExperiment()
417424
{
418425
if (hasInitialised)
419426
{
427+
isQuitting = true;
420428
if (inTrial)
421429
currentTrial.End();
422430
SaveResults();
423431
fileIOManager.Manage(new System.Action(fileIOManager.Quit));
432+
isQuitting = false;
424433
}
425434
}
426435

@@ -429,7 +438,7 @@ void SaveResults()
429438
List<OrderedResultDict> results = trials.Select(t => t.result).ToList();
430439
string fileName = "trial_results.csv";
431440
string filePath = Path.Combine(sessionPath, fileName);
432-
441+
433442
// in this case, write in main thread to block aborting
434443
fileIOManager.WriteTrials(results, filePath);
435444
}

0 commit comments

Comments
 (0)