- Home /
I can not figure out The referenced script on this Behaviour (Game Object 'MainMenu') is missing
Whenever i try to go from one scene to the next and i get the error referenced in the title Mainmenu is an empty game object child to the canvas with menu buttons and text under it.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour {
public void PlayGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
public void QuitGame()
{
Application.Quit();
}
}
Answer by Captain_Pineapple · Feb 15, 2019 at 10:15 PM
Hey there,
if you stumble upon this error you have to check the Gameobject named MainMenu in the scene that you just tried to load. At some point you attached a script as component to this object but probably later on removed said script from your project. In the end this leaves unity with a reference on a gameobject to a script that does not exist. Just remove the "missing component" from this object and you should be good to go.
Your answer
![](https://koobas.hobune.stream/wayback/20220612191755im_/https://answers.unity.com/themes/thub/images/avi.jpg)