When I add two widgets to the screen at once, nearly identical, and set them both to display a message when I hover over the button, only one of them works. They both consist of a canvas panel with a size box and a button. I made these as an example, representative of the broad problem I have been encountering with other widgets. The bottom line is that basically any time I have multiple widgets on screen only one of them works as far as mouse interaction. I have managed to produce one test case where it works, but I cannot figure out why it works so that I can replicate it.
So, when I hover over the one on the right, with the same code, it doesn’t work. Any ideas why? I am having a variety of similar problems, I have tried everything I can think of, this is just a simple example of the issue.
To be clear, I am looking for a diagnosis/solution, not alternatives. I know that an answer to this problem exists, as I have a working example. I just haven’t figured out yet why one works and another doesn’t. Thanks.
The one working example I have produced, where I can interact with both widgets, also includes multiple canvas panels. I’ll check settings on them again and be sure though. Thanks for your reply.
Okay, now this is interesting. In the OP, I have now replaced the lefthand widget with a completely empty widget. Once I create it and add it to the viewport, same problem. How on Earth can an EMPTY widget do this?
Okay, I took the two menu widgets from the working example and migrated them to another project. I created them and added them to the viewport. I did this in the same place as OP. Only one of them accepts input.
So, what does that leave us with? I mean, surely that rules out anything about the widgets themselves, right? So what are we left with? Level? Controller? Project Settings?
Unfortunately this isnt lines of code I cannot use print strings to figure out where the breakdown is…
I have tried using the widget reflector, but I probably don’t understand it well enough. One interesting note is that when I added the empty widget and hovered over the viewport the whole viewport was highlighted and the empty widget was indicated on the reflector, and it said visible, even though the widget was not set to visible??? Seems important to me but I don’t know what to do about it.
Okay, I figured it out. I had been using a bad practice that I probably learned from a video a few years ago, and I never really understood what I was doing.
When I first learned how to use widgets, I was taught to create the widget, add it to the viewport, and then use the set visibility node to make it visible. What I did not understand until just now is that is NOT what the set visibility node is for. What it does is override the default visibility settings for the widget. So basically, until now, I have always been setting all widgets to visible when creating and adding them. In my one example that was " working", I just so happened to not have used the “set visibility” node.
So here is the bottom line: I was using the “Set Visibility” node on every widget (to visible), and overriding the visibility settings, thereby making every part of every widget fully visible and hit-testable. The solution: don’t do that! Thanks to all for reading this, I am sure you gave it some thought and effort, but probably couldn’t have guesses that I was doing anything that silly!