Why is discrepancy with getting mouse position on functions vs. events by design? (Bug Ticket #UE-66596)

I also found out this discrepancy the hard way and wasted a lot of time because I was using functions. This issue reported by someone with the same issue as me got closed.

Link to issue: Unreal Engine Issues and Bug Tracker (UE-66596)

“There seems to be a discrepancy between the output of Get Mouse Position node depending on whether the node is inside an Actor function or called from Event Tick. If the node is present inside a function, then as soon as the mouse cursor leaves viewport/window area, the node returns 0, 0 vector. If the node is present in the event graph, not wrapped inside any function, then if the cursor leaves viewport, the node keeps reporting last known cursor position.”

"(Project has been attached for easy replication & reproduction)

  1. Open up Unreal Engine 4.21 and Create a blank project.

  2. Create a Actor Blueprint named “Report Mouse XY”

  3. Right click on the Event Graph-> Get Player Controller

  4. Off of Get Player Controller → Get Mouse Position.

  5. Off of location X and Y, Make a Vector 2D.

  6. Off of Make Vector 2D Return value, call function BuildString(Vector2d)

  7. Off of Event Tick, Create a Sequence Node.

  8. For Sequence 0, pull off a Print String Node.

  9. Plug in the return value of Build string into the In String of Print String.

  10. Create a custom Get Mouse Position Function (see GetMousePosition CustomFunction.png)

  11. Call Get Mouse Position Custom Function.

  12. Make a Vector 2D from Location X, and Y

  13. Off of the Return value, use BuildString(vector2d)

  14. Add another pin to sequence, and plug in Print String.

  15. Compile & Save

  16. Play In Editor, and move the mouse cursor across the viewport. Until it is off the viewport.

  17. Observe the numbers of In Event Graph, and Inside of Function.

Result: Get Mouse Position node returns 0, 0 result as soon as the mouse cursor leaves viewport area if the Get Mouse Position node is contained within a blueprint function.

Expected: Get Mouse Position node should always return last known cursor position if the cursor exits the viewport, whether it is called from Tick, or from the Actor pure function."