0

I have an odd problem no one else seems to have encountered. I have some buttons in my game that do respond to clicks by changing color, but the functions added to the list of OnClick events do not get called.

I have an event system with the new Unity UI input module attached.

When I place a breakpoint in the selectable class that the button inherits from, the color change code is being called. However when I place a breakpoint in the button code on the OnClick event, it is never called.

I'm not sure what to do at this point, any help would be much appreciated.

enter image description here

Dollarslice
  • 9,917
  • 22
  • 59
  • 87

1 Answers1

0

We have several possibilities:

  1. There may be some interface in front of the button making it impossible for it to be activated and call "OnClick".

  2. The button image has the "Raycast Target" boolean disabled, not allowing the button to be clicked.

  3. The function called may have a problem, to be sure it's not her, call a function that only sends a log to the console.

  4. This new input system, may not be receiving the correct call, you can study the "ExecuteEvents" code, it shows the "EventFunction" and interfaces that are used in the standard modules, it's kind of complicated, but I believe this one can be a good guide for you who are doing a new module.

Hope I helped in some way and good luck.

  • I think 1, 2 and 3 might be rules out by the fact you can click on the button and see it change color. what do you think? – Dollarslice Jun 19 '23 at 01:06