void ResetLevel() { //Instantiate new player _player = Instantiate(playerPrefab, spawnPoint.transform.position, Quaternion.identity); //for each ghost in ghost list: foreach (Path path in _paths) { //instantiate new ghost object, set to curGhost GameObject ghostBeingInstantiated = Instantiate(ghostPrefab, spawnPoint.transform.position, Quaternion.identity); //curGhost set the move list in the new object to the current ghost ghostBeingInstantiated.GetComponent <Ghost>().Move(path); _spawnedGhosts.Add(ghostBeingInstantiated); } //set prev_x and y to current movement (so if they're holding a key down when they respawn //it keeps movement float initialX = Input.GetAxisRaw("Horizontal"); float initialY = Input.GetAxisRaw("Vertical"); timeElapsed = 0f; //add blank datapoint to currentGhost dataPoint list _currentPath.AddDataPoint(initialX, initialY, timeElapsed); _coroutine = StartCoroutine(DieRoutine(ghostTime)); }