I’m building my UI for my project using UI Toolkit but I’m building them in C# as I strongly prefer that over UXML or the editor solutions. Here’s the problem, my buttons are behaving strangely and I haven’t had this issue before.
I’m working in Unity 2023.2.14f1 for context. I’ve created my main menu with no issues at all, it has sub menus as well, one for controls, settings, and context for player abilities. Each sub-menu has a button that redirects back to the main menu. In the main menu, these all function perfectly as expected.
I just created a pause menu, which has buttons: Resume Game, settings, controls, and again context for player abilities. As you may assume, I’m reusing the menu’s from the main menu here. The pause menu buttons work just fine, except for the last one: the quit to menu button. I assure you, I’m creating them all the same way, but that’s not even related to the problem, as you’re about to see.
Like I said earlier, I’m reusing the main menu’s submenus for the pause menu submenus as well. Literally 1 for 1 the same, the same prefab is used for both with no modifications in either scene. However, in the pause menu, these aren’t working. The button on the submenus that closes them and reopens the previous menu isn’t working.
This isn’t an issue with the C# programming for the buttons functions. I have a Buttton:hover and I can see that it isn’t registering the mouse hovering over the buttons except in very specific positions around the top or bottom border of the buttons. I mentioned in the title “consistently but not always” and that may be confusing. It’s not always because like I said, in my main menu those sub menu’s work 100% of the time, but it’s also consistent because the buttons that don’t work correctly in the pause menu never change.
Again, I’m using the same method to build all my menus but that’s not relevant because the same menu is behaving differently in different scenes. If anybody has any advice on how I can fix this, I would greatly appreciate it. Thanks!