I am developing a tower defense game, and created a plate(called tower-pods) with a widget for building towers.
However, the widgets often fail to recognize clicks, so it becomes very hard for game players to click buttons.
Please see the GIF link below. I placed 6 tower pods. Red circles are clicks.
[link text][1]
As you can see, I could create a right-most tower easily, but I had really hard time to create tower at other positions. It seems that the widget button recognize the mouse cursor (since it becomes brighter), but for some reason it doesn’t take my click. How should I improve this?
This is the tower pods(base for tower). It has a cylinder on top, and if the cylinder is clicked a widget will show up.
336542-
And when the cylinder button is clicked. A widget is spawned. as in the link below.
And since this is a widget component, can we see the actor hierarchy? Is there a sphere collision somewhere that can be consuming input prematurely, or another component that could interfere? Made not Visible so it does not show up in the viewport?
Yes, ‘receive hardware input’ has been checked, and nothing is overriding on-click event.
I added Set User Focus as the picture in the link below. Clicking widget’s button became a bit easier, but didn’t fix the issue fundamentally. (Also the widget’s hierarchy is included in the link)
Text blocks in the widget had been at ‘visible’ mode. So I changed it to ‘Not Hit Testable(Self-Only)’ as you mentioned. However, the issue is still happening.
The TowerPods actor is like below. I enlarged the ‘tile’ to check easily whether interference exists.
Also I drew a few purple lines to show what they are in Component hierarchy.
Button : the cylinder on top. This takes ‘click’ event to add widget and to show/hide the widget
Scene : used to hold location information for the widget. It is a very small sphere right below the button. (This is being selected in the picture below)
Currently nothing is using LMB. LMB action mapping is not registered in project setting.
I removed all other actors except for this TowerPod, but nothing changed.
Currently, level BP is the only BP I have other than this TowerPod and its widget.
To check if the ‘enable mouse over events’ affects something, I removed the node, but nothing changed either.
To check if there is something to cover widgets, I played game in wireframe mode.
Here I found the widget takes relatively huge space, and doesn’t disappear after I created tower.
I will figure out how to fix this, but I don’t think this is the fundamental cause, because this symptom happens even when I click the first tower for the first time after I run the game.
Consider adding widget component to each tower (rather than spawn it dynamically) so the tower already comes with its own widget - this will also simplify communications between the 2. That widget component can be hidden when not in use.
Fantastic! I have been suffering from this for hours and days, and you saved me HUGE amount of time. I will also switch the dynamic widget to static one as you advised. Thank you so much and have a great day!