Button double click

I can’t seem to get any button double-click information from a unity button.

I can use IPointerClickHandler, but then I have to disable the button entirely or the function won’t get called.

But then I lose all the default button behavior.

Isn’t there a way to get the double click information directly from a button listener?

Otherwise it seems like I have to rewrite all the button code and add double click support.

solution is probably to just subclass button and add the new IPointerClickHandler there.

I tried this and it works.

2 Likes

Hello @the_lemur

I think I have the solution for you. You want to make a class that inherits from the Button class and simply add IPointerclickhandler.
I do not know if Button already implements IPointerClickHandler. If it does you can override onpointerclick, call base.onpointerclick and run your code afterwards.

Hope I helped enough, I cannot check it because I am not at home. Tell me how it went :wink:

I don’t suppose you’d consider sharing some code?