Can't convert mouse position to worldspace with "OnDrop" function in UMG

I’m trying to make a drop and drop material system using UMG. I’m running into an issue when converting the mouse position from screenspace to worldspace when a widget is dropped on the screen. I’m using the results to run a linetrace from the sceen out into the world.

I don’t run into this issue when running the conversion on tick, only when using the “OnDrop” function. If I get the mouse position from the player controller, it just returns as 0,0.

If I use the position from the “pointer event” in the function, the direction seems to be wrong, no matter the maths I use, causing the line trace to go out at an unexpected angle.

Here’s the function: Screen to World attempts posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
You can see all the different ways I’ve tried to get the projection to work but I’m having no luck.

Here’s the working blueprint from my pawn’s event graph: Screen to World attempts (B) posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
This math doesn’t work inside the widget as previously mentioned, the “mouse position” just returns 0,0.

I’d appreciate any guidance on this.

I’ve got the system working by using a blueprint interface so the majority of the logic happens in the pawn blueprint. However the mouse position still returns 0,0 unless a delay is put between the interface and the linetrace. This tells me the mouse input is being consumed for a few frames after the drop event.

Here’s the blueprint for this fix: Screen to World attempts (C) posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4

I’d like to keep the logic in the UMG blueprint. Anyone got any ideas on how I can get around this issue?