- Home /
Button is not selectable when pressing the submit button even though it is highlighted. How do I fix that?
So I have a menu that pops up and I am assigning one of the buttons to be the currently selected on via script and that button appears highlighted. Now when I press the A button on my controller which I have set up as the submit button the button does not get pressed. I have to move the analog stick on the controller to another option on the menu before the input will start working. This means to select the first option in the menu I have to move the analog stick in one direction and then back to the first option for it to work. Any ideas on how to fix this or what is going on?
What are you doing to "select" it? If you draw a thing above it that is transparent I know you won't be able to click on it. Can you show us the code? And maybe explain the heirarchy a bit. A picture would be good.
there is nothing above it. I am making it the active button through code such as this main$$anonymous$$enuEvents.SetSelectedGameObject(titleButton, new BaseEventData(main$$anonymous$$enuEvents));
what I am doing to get rid of an the stuff that would be drawn above it is setting those game objects to be not active anymore.
I am able to click the button easily with the mouse but even through the button is highlighted and the submit command is mapped to the A button on my controller, pressing A will not make send the click command until I move the joystick a little.
If using your controller then I guess you're not doing a mouse click or touch action. The button is effectively not needed but I guess you want to show it being clicked. If so then just reference the button in the script you record the controller being clicked and change the color of the button briefly.
Well i want to use the buttons because I'm using the new gui system and the navigation is nice for moving between the buttons. The problem is that the joystick has to be moved before I can actually cause one of the events to occur on the button that I set up. I have tried the on click event as well as the submit event but both has the same results
I think you're missing the point of the new UI it simplifies thing's for where you need to use pointer (finger or mouse) but for what you're doing you just need to record the click on the controller and provide a visual reference that it has been clicked.
I dare say there's a way to pass it a click but you really don't need to you can pass back the selection via code, that's what you'd do with the event system but no need to involve the event system if using a controller. You're just adding work for yourself which is the opposite of what the Event System should be. You can still use the navigation system to show which is selected.
If you really want to use it this way I'll see if I can work how to pass via code an OnClick but just "flashing" the button to show it's been clicked is plenty good enough for your setup. You can pass the code you'd implement in the OnClick via the code you record the controller click.
Let me know if you need any help with any of it.