Totally stuck again...
I've followed the AC tutorial on creating main menu and then the 2nd one on how to make it not pause the game. So now I've got my first scene, the main menu shows up as it should (start new game, load, options, no save etc) without pausing anything, but none of the buttons are selected and moving the controller stick does nothing at all (though on few ocassions by wagging it like crazy I managed to hover onto some of the options; still, it felt like something was really off with the input since it wasn't just the vertical axis but both of them it seemed).
After hours of searching through this forum I am now pretty sure I need to use Unity UI to make the controller/keyboard work... But I've tried it and found it pretty hard to understand. I mean, I've put NewGameButton as the First Selected element in my Title menu tab and clearly that's not doing anything. I have no idea what to put in LinkedCanvas or ReactTransform boundary boxes... It feels like I should have Title menu's prefab somewhere but how to I make a prefab of a menu?
Also, I'm pretty sure something's wrong with the Unity inputs. I've got horizontal set to X axis and vertical to Y axis and in game it works alright - I can control my character to walk left and right (direct control 2D game where you can only walk left/right using player constrain movement up/down), I can select inventory items with the stick's X axis but the Y axis is just wild and out of control... (without the up/down constrain the player just flies off to the sky like if the stick is permanently pushed up
)
What I'm asking here, I could really benefit from a more in depth tutorial on how to make this menu work with keyboard/controller setup (because it works fine with mouse cursor btw). I know AC is mainly focused on point&click games but adventure games genre seems to go in direct control direction these days more often than not so I think a lot of people would benefit from it.
So yeah, I've spent like 8 hours trying to figure it out already. I need help...
Please?
Comments
Then... I thought "screw it, maybe I'll learn something in the process". So I followed the tutorial and made the inventory, realized that it's not that hard after all I went and built a main menu based on this new knowledge and voila! I've got a basic yet lovely menu, I can highlight buttons with keyboard/controller and press on them to make them click. Perfect! I've got two problems though: the clicking doesn't do anything and menu:turn on/off doesn't work on it, except if I leave it in the scene - then it's visible from the start. So I guess I'm still missing something... but progress!!!
(and just before you ask, I did add for the start new game button the Click Type: Run Action List with the little action assigned inside to turn off the menu and start moving the camera... except it doesn't do anything for some reason).
Any idea why this could be happening?
Know that each of the Menus in the default Menu Manager (Demo_MenuManager) have Unity UI counterparts, which you can pick apart for learning with. Just change the "Source" for e.g. the default Pause menu to Unity Ui Prefab, and you should see it's associated UI listed beneath.
The menu does appear for a split second like seen on the first image and then all buttons go completely blank and don't respond anymore.
http://i.imgur.com/0mf2Z6c.png
It seems all is plugged in alright, the fields are still blank but the ID numbers show...
http://i.imgur.com/6qIxgoZ.png
I added the Event System to the prefab which I believe takes care of keyboard controls for the menu (and in fact does work when my menu is left in the scene, though presses don't produce any effects...)
PS. It doesn't show up when set to enabled on start...
-The menu pops up okay, the buttons are no longer blank because now I've put text in AC instead. (Thanks for the tip )
-I can click on it with mouse cursor and it does start the game, but keyboard/controller still does nothing (despite the fact that when it is left in scene the keyboard works and the buttons get highlighted, except then they don't start the game; I know you said menu won't work that way so I'm not surprised, just a little curious why keyboard only works there...?) Once I remove it from the scene the menu becomes unresponsive to keyboard again.
- This line of code: EventSystem.current.SetSelectedGameObject(MyButton); - I don't really know what to do with it. Where do I add it?... Is this the reason keyboard controls don't kick in? Which part of the menu (canvas, panel or grid) should I add the standalone input module to, if any at all?
Sorry to bother you so much with these but I feel like I've followed every single step correctly and I'm really close to getting the result I want.
Thank you so much, Alverik!
I removed all the extra Event systems, added your SetUIFocus to my canvas and changed menu's appearance to During Gameplay and now it's working!
I do watch plenty of online tutorials on all different aspects of using Unity but some things are hard to find... or sometimes just worded in a way that doesn't quite explain what you need to know. Anyway, once more, I really appreciate yours and Chris's help Couldn't have done it without you
I'm sure I'll be back soon for more help hehe But the game's progressing day by day. Here's the first scene:
---
ME: So I keep bouncing from this thread to the ReWired one for putting the final touches on my game controller implementation. I'm super close but one hurdle that I'm running into is how to deal with custom save game labels (https://adventurecreator.org/tutorials/custom-save-game-labels).
If using mouse, I can click in the input box and I can then type whatever I want but if I'm using a controller, I can never get the text input cursor to appear. If I click the button I have associated with submit on the input box like I would with the moust, it plays the sound that I have set up for a submit, but doesn't let me change the name at all, so I can't type anything into the input box. I need to switch over to mouse & keyboard in order to select the box and to type in a custom name. I've tried setting up an actionlist to manage systems to maybe give me a mouse cursor using my controller (right stick controls the cursor) but no dice. I'm guessing it's because it's an in-game menu, so it's pausing the game.
---
CHRIS: Is your menu displayed using AC or Unity UI? What's the first element that's to be auto-selected when the menu turns on? If it's the Input box, try the "Submit" button and then navigating to the Input box from there.
---
ME: The menu is an AC one...and I'm not seeing an option to auto-select a particular element. Here's a screengrab:
https://imgur.com/a/8nCIG0g
I think the only time I've seen the auto select option show up is if I make it a Unity UI menu.
And it's definitely paused. It's the in-game save menu, so I made sure the "Pause game when enabled" option was flagged.
---
CHRIS: If it's AC, then the first in the stack will be auto-selected. Swap around the Button and Input to see if you can navigate to it that way.