You could create a custom button with a User Widget and check its alpha.
Follow these steps:
-
Create User Widget (WBP_CustomShapeButton) and add Image:
-
Add variables and Event Dispatchers like here:
ButtonImage - Texture2D
Normal, Hovered, Pressed - SlateBrush (Instance Editable)
ButtonRenderTarget - CanvasRenderTarget2D
IsMouseOver - Bool -
Create Material that you draw to Render Target later:
-
Add Pre-Construct Event to Event Graph.
-
In the WBP_CustomShapeButton, create a Macro that will check alpha:
-
Override mouse functions OnMouseButtonDown, OnMouseButtonUp, OnMouseMove:
-
Override OnMouseLeave event:
Your custom shape button is completed.
Then apply it:
- Add the button to your desired widget and fill the style:
Events: