- Home /
UI canvas or panel that only appears once per game session?
The goal is to have a Home screen, for when you open up the app, the game, and a re spawn screen. I want the home screen to only appear when you start up the game. Then when you click play it takes you into the game, but after that the only ui that pops up would be the re spawn screen after you die. The only problem is when you use Scene Manager to reload the scene, no matter what I do, the home screen always pops back up. I've looked around and haven't found any answers to this, but I've seen some mobile games that do this. An example would be "Go Plane!" on the app store. Any help is extremely appreciated. Thanks.
Answer by tablazonsimon · Mar 10, 2019 at 04:41 AM
If you use two different scenes, one for a main menu, and another for the game, then that could be achieved with something like this because it would only reload the game scene:
public void reloadScene () {
SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex);
}
However, if you're going the single scene route, a way you might be able to achieve this is to just count the amount of times the scene is loaded, like with this:
static int loadCount = 0;
private void Start()
{
loadCount++;
if (loadCount > 1){
hideStartMenuUi(); //or perhaps something like StartGame();
}
}
I don't know why I didn't think to try that. Thanks.
Your answer
Follow this Question
Related Questions
Multiple EvenetSystems in Scene - only have 1 after searching though 1 Answer
Attempting to Create an Essential SceneElements Checker 0 Answers
CheckConsistency: GameObject does not reference component Animator. Fixing. 0 Answers
Bolt Visual scripting and loading different scenes/levels 1 Answer
Adding to delegate with multiple instances of the same object 1 Answer