I am using

SceneManager.LoadScene(SceneManager.GetActiveScene().name);

to reload my current scene in unity , but when i run the game ,in hierarchy lots of scene are appearing. Also if i do some editing, i can not save the scene any more. unity is giving and error "Overwriting the same path as another open scene is not allowed". I am new to game development. I would appreciate any help.

• You need to make sure you call the function only once when you want to. It appears you are calling it multiple times, in Update() or somewhere that gets called multiple times. – Lasse Sep 13 '17 at 6:08
• I am using it only when user collide with an enemy object void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Enemy") { makeDead (); } } – Jayakrishnan Sep 13 '17 at 6:15
• makeDead  has SceneManager.LoadScene(SceneManager.GetActiveScene().name); – Jayakrishnan Sep 13 '17 at 6:16

This might be solution to your problem, but I can't say for certain.

This is what I usually do to prevent collisions from calling the same function multiple times:

bool dying = false;

void Update()
{
{
}
}

void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.tag == "Enemy")
{
dying = true;
}
}


Error: Multiples "loading or is not loaded" scenes in the editor hierarchy. Error: "Overwriting the same path as another open scene is not allowed".

SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);