- Home /
Best programming practice for making in game menus
I'm working on a Pokémon game similar to the originals. Within the game there are lots of menus and sub-menus. While some menus share common variables and methods, each one has specific actions that are only carried out in that menu. And some menus function differently depending on other factors, like whether you're in a battle or in the overworld.
I have a system where all the classes share a parent base menu class with all the common methods and variables. Each menu class then has unique methods and variables. Often though, I have to override the shared methods because of all the specific actions that only happen in that menu. On top of this, I have a menu controller class that handles menu switching. This works ok for lots of customization, but I find that I'm re-writing a lot of code for each menu, and I'm using a lot of if/switch statements in the Update() method. I'm also concerned with how many custom classes I'm using.
I'm fairly new to writing code and designing games. I feel that I'm missing something or maybe overthinking this. Is it normal to have custom classes for each menu in a game? I've seen other people suggest using state machines, but it seems like I would still have a unique state class for each menu. Any help would be appreciated!
Your answer
![](https://koobas.hobune.stream/wayback/20220613031557im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Help with input code please (c#) 1 Answer