- Home /
Scenes overlap in Game view in Editor and Game is stuck in Main menu after installing in mobile.
Hi. I'm made a pong Android game for practice. There are two scenes, Menu and Game. In the game view, both scenes are playing at the same time. Once I click the Play button, my UI button to change scene, the menu scene disappears and the game is playing.
And I dont know whether this is the reason, but after I build the game and install in my android mobile, the game starts, Unity logo is working and then when Menu scene started playing, the game gets stuck. The Play and Quit UI buttons are no longer working, even though they worked fine in the Editor Game view.
(I made a separate UI button app which when clicked, closes the app. It is working fine in my mobile. So, the input method is working.)
This is the code I used to change from Menu scene to Game scene.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void PlayGame()
{
SceneManager.LoadScene("Game");
}
public void QuitGame()
{
Application.Quit();
}
}
Please tell me what can be the issue, this is the only code that handles scene change. Thanks in advance.
This is how it looks in the Game view, with both Menu and Game scenes overlapping.
Answer by AC_Sandy_SK · Nov 27, 2021 at 10:42 PM
As like yesterday, I found the solutions to my questions after some mucking around. Instead of removing the question, I'm gonna let it stay here with my own answer, so others facing similar issues can benefit from it.
If I'm correct, Scenes overlapping issue was bcoz I had two scenes in the hierarchy window, but added them all in a single Scene view window. If I worked on each scene separately, there's no more issues.
As for the game getting stuck, its bcoz I didnt add an Event System component to the scene. Since I had two scenes in the hierarchy window and the Game scene had an Event System component, the editor didnt let me add another Event System component to the Menu scene. So I worked on the Menu scene separately and added the component.
Now the game is working, albeit with some UI issues.
Your answer
Follow this Question
Related Questions
How To Save Health Between Scenes 1 Answer
How to write a change Scene 2d for multiple scene 2 Answers
Predfined Level Generation Procedural vs Scene 1 Answer
Transition between levels using 2d colider works once but not repeatidly. 1 Answer
This script is not displaying scenes in unity properly. How would you fix it? 0 Answers