- Home /
Main Menu causing glitch
I just created a mini game (roll a ball), a main menu and a game over scene. All the scenes tested individually worked just fine. Then I added them to the build settings and the main menu started glitching upon playing. Also even when trying to play the mini game it loaded the main menu. Below is a picture of the odd error occurring where it will saying "is loading" , "not loading" over and over again very rapidly, not seemingly allowing me to interact with any buttons on my scene. Could anyone tell me what is going on? By the way, there is nothing with a DontDestroyOnLoad in my Main Menu scene.
This is what I have for my level manager, nothing static. That's the only code in the scene, used for managing buttons
public class Levels : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void LevelOne()
{
SceneManager.LoadScene("Level 1");
}
public void Main()
{
SceneManager.LoadScene("Main");
}
public void Loading ()
{
SceneManager.LoadScene("Example");
}
}
Those methods are cal UIled by buttons?
Answer by HellsHand · Apr 12, 2021 at 08:48 PM
Try changing the method name of your main scene method to something besides Main(). Main() in C# is the start of any script when not using Unity so it's possible it might think it's supposed to run that whether or not you called it.
Answer by PolymathicIndustries · Apr 12, 2021 at 06:40 PM
@rh_galaxy, @MSavioti, any thoughts why this problem would happen with the code above?
The code you showed above does nothing on its own. You need to show the code that runs the scene switch. You probably change scenes all the time over and over?
Your answer
Follow this Question
Related Questions
How can i move the camera smooth like flow up and behind the player when clicking the escape key ? 0 Answers
How do i add an extra menu to my main menu (I'm a Beginner programmer!) 1 Answer
How to have music not restart between scenes? 1 Answer
Changing two different objects renderer colour 1 Answer
How to Create a Main Menu with an Animated Background 0 Answers