- Home /
Main Menu: Is it better to subdivide it into different scenes?
I'm making a MOBILE game and I'm worried about performance. I want the game to look good with transition effects and such, but I don't know if making all the submenus in the same scene as the main menu is worth it. Are there any tricks for making this happen? Or is it better to just make them in separate scenes?
Thanks in advance. :)
You could have an enum with the different submenus and then use switch/case to put the gui.
If you make them different scenes, you will limit your options when it comes to transitions, you will clog up your build scene list and you will have massive (exaggerated) loading times between menus.
Remember that it is just a main menu. You're not going to have any fancy expensive physics or gameplay scripts running.
There is such a thing as "Over Optimizing"
Answer by IR Nifty · Jul 14, 2013 at 03:39 AM
It depends on how your menu is set up. The system I use is an enumeration depicting all the different menus, like main, options, graphics, sound, etc. and a simple switch in OnGUI to render each menu only if it is active. This I find is incredibly light on performance. I get over 600 FPS with it and there are still a few models and particle systems in the background.
I can give you a simple example:
enum Menu = {Main, Options, Graphics, Sound}
Menu currentMenu = Menu.Main;
void OnGUI ()
{
switch (currentMenu)
{
case Menu.Main:
RenderMain ();
break;
case Menu.Options:
RenderOptions ();
break;
case Menu.Graphics:
RenderGraphics ();
break;
case Menu.Sound:
RenderSound ();
break;
}
}
void RenderMain ()
{
//Build your main menu here.
if (/*options button is clicked*/)
{
currentMenu = Menu.Options;
}
}
void RenderOptions ()
{
//Build your options menu here.
}
etc. etc.
So in each Render___ method, you simply build your menu in code, set the buttons to change the enum, and it will automatically change the menu!
Or ins$$anonymous$$d of using if/switch statements, you can keep several GameObjects or Components with the menus and enable/disable them on demand.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Top down house Help 2 Answers
NullReferenceExeption: Object reference not set to an instance of an object. 1 Answer
Needing help with mobile multiplayer. 2 Answers
OnMouseDown Range Problem 1 Answer