I am not able to load my main scene from different scene.

i have attached this script to a a button OnClick function and it should load “main” scene but it unable to stay at the main scene. it loads it first and then reloads it agian.
using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

	public void Restart() 
		Application.LoadLevel ("main");

Once you load a new scene everything from the previous scene is destroyed unless you tell an object not to, so there are 2 possible problems:

  • You have some code that’s executed automatically in the main scene that reloads it. Or…
  • You set the button to not being destroyed when loading a new scene, and that Restart method is being executed again.