public void CloseLogs() { StopLogging(); if (_experimentInfoLog) { _experimentInfoLog.Close(); Destroy(_experimentInfoLog); _experimentInfoLog = null; //because of timing issues when closing and opening in one method } if (_playerLog) { _playerLog.Close(); Destroy(_playerLog); _playerLog = null; } }
//RETURNS if logs already exist, otherwise reinstantiates them void InstantiateLoggers(string participantId) { if (_playerLog && _experimentInfoLog) { return; } //to get one timestapm in order to synchronize loading of log files CreationTimestamp = DateTime.Now.ToString("HH-mm-ss-dd-MM-yyy"); //instantiates the log _playerLog = gameObject.AddComponent <PlayerLog>(); _experimentInfoLog = gameObject.AddComponent <ExperimentInfoLog>(); //var experimentInfo = SettingsHolder.Instance.ExperimentInfo; if (participantId != null) //if we have an ParticipantId { _playerLog.Instantiate(CreationTimestamp, participantId); _experimentInfoLog.Instantiate(CreationTimestamp, participantId); } else //the defaults { _playerLog.Instantiate(CreationTimestamp); _experimentInfoLog.Instantiate(CreationTimestamp); } }