The IsClicked is just a boolean variable indicating whether you have done a click before, it is set to false by default and the ResetIsClick is just a function which sets IsClicked to false. The important thing here is that you have to set a time in SetTimerByFunctionName that makes you feel like a button it is double clicked, to me 0.3 second seems okay.
I am using 4.23 version and got the same problem on mouse button double click and preview mouse button down to implement both drag and drop slots as well as double-click to use slot.
Here is my solution:
On the slot button, set click event, and picture will be the first one down below, create a variable to save left mouse button click count, give it a default value of 1.
And for override preview mouse button down function, the right mouse button will pop up the action menu which in this case can be ignored, then when detect failed, check whether drag can be detected, then everything will be fine.
This is still a problem in 5.1, do you guys have news about it? does this have any kind of solution or is the “custom double click via timer” the “only way”?
Ahhh noiiceee, this worked like a charm, I’m following the tutorial, great stuff! Best inventory tut out there IMO.
Just wanted to add 2 things regarding your function that I needed to change (assuming that this is indeed the same tutorial )
“ClickCount” needs to be reset to 0 both times, or double click will only work the first time, after that single clicks will trigger;
There’s a need to also verify if the Item “isUsable” or else the double click will consume any item, not only the usable ones.
I have been following the same guy and it has been great. For some reason to get this solution to work I had to set the #of clicks check to greater than 0.
In my case(custom 4.25),touch event dont has this issue,so mobile platform will not be effected,and can check “use mouse as touch” in project settings and it works good(its ok to still use on mouse button up in widgets)
If you dont want to do that for some reason,set the input mode to ui only also fix this (get player controller->SetInputModeUIOnly).as a great habbit you may overwriting OnMouseEnter and OnMouseLeave to set its use ui only mode and not.
Easy solution is to wrap your widget into Border (change Draw As: none). Border has built in double click event which you can utilize. However Border doesn’t have OnClick event so place a Button as a child to your Border.
End result should look like Border->Button->YourMainContainer.
This way you don’t need to override MouseDown events for entire widget and no need in any kind of delays and counters.