//RETURNS if logs already exist, otherwise reinstantiates them private void InstantiateLoggers(string participantId) { CloseLogs(); //to get one timestapm in order to synchronize loading of log files CreationTimestamp = DateTime.Now.ToString("HH-mm-ss-dd-MM-yyy"); _playerLog = gameObject.AddComponent <PlayerLog>(); _experimentInfoLog = gameObject.AddComponent <ExperimentInfoLog>(); _playerLog.Instantiate(CreationTimestamp, participantId); _experimentInfoLog.Instantiate(CreationTimestamp, participantId); }
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) { return; } _playerLog.Close(); Destroy(_playerLog); _playerLog = null; }