Why does my game freeze 1 second after ResetGame is called?,Why does the game freeze after my player gets respawned?

Hi Guys, Ive been doing this Zombie Runner tutorial by Jesse Freeman and just finished the reset game after the player is DestroyedOffScreen. What should happen after that is:
when anyKeyDown - the game resets and drops the player in the screen again while slowly resuming the velocity of all objects (wall, floor, obstacles etc.)
What Actually happens after the player is destroyed is:

  1. The player is dropped in the middle of the screen
  2. The game resumes velocity for a moment
  3. The game freezes and it doesnt matter if I press any key from that point on

Here is my GameManager script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManager : MonoBehaviour {

	public GameObject playerPrefab;
	private TimeManager timeManager;

	private bool gameStarted;
	private GameObject player;
	private GameObject floor;
	private Spawner spawner;

	void Awake(){
		floor = GameObject.Find ("Foreground");
		spawner = GameObject.Find ("Spawner").GetComponent<Spawner> ();
		timeManager = GetComponent<TimeManager> ();
	}

	// Use this for initialization
	void Start () {
		var floorHeight = floor.transform.localScale.y;

		var pos = floor.transform.position;
		pos.x = 0;
		pos.y = -((Screen.height / PixelPerfectCamera.pixelsToUnits) / 2) + (floorHeight / 2);
		floor.transform.position = pos;

		spawner.active = false;
	
		Time.timeScale = 0;
	}
	
	// Update is called once per frame
	void Update () {

		if (!gameStarted && Time.timeScale == 0) {

			if (Input.anyKeyDown) {
			
				timeManager.ManipulateTime (1, 1f);
				ResetGame ();
			}
		}

	}

	void OnPlayerKilled(){
	
		spawner.active = false;

		var playerDestroyScript = player.GetComponent<DestroyOffScreen> ();
		playerDestroyScript.DestroyCallback -= OnPlayerKilled;

		player.GetComponent<Rigidbody2D> ().velocity = Vector2.zero; 

		timeManager.ManipulateTime (0, 5.5f);
		gameStarted = false;
	}

	void ResetGame() {
		spawner.active = true;

		player = GameObjectUtil.Instantiate(playerPrefab, new Vector3 (0, (Screen.height /PixelPerfectCamera.pixelsToUnits)/2 + 100, 0));
	
		var playerDestroyScript = player.GetComponent<DestroyOffScreen> ();
		playerDestroyScript.DestroyCallback += OnPlayerKilled;

		gameStarted = true;
	
	}
}

Hi,
thanks for the reply : )

The purpose of Manipulate time is to slow down time after certain events like The player getting killed (offscreen) - this provides a nice transition between the end game and the restart.

I found the solution to my problem. It turned out that in my TimeManager script I was trying to “return false” I was given an error message notifying me to use either “yield return” or “break”. After trying out both ways to run the game I found that “break” is what I was missing.

Is there a way to notify the forum moderators that this topic can now be closed or moved to a “finished” section?
Thanks