Search Unity

Question Getting Pointer Position while Hovering over RectTransform

Discussion in 'UGUI & TextMesh Pro' started by jashan, Oct 19, 2020.

  1. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    This should be easy ... but apparently, it's surprisingly hard: I need to know the position of the pointer(s) in a specific RectTransform. This is for a UI that works both in flatscreen and VR, so I can't use the mouse position.

    Is there any way to do this without major hacks?

    Basically, if I could simply access
    Code (CSharp):
    1. public class StandaloneInputModule : PointerInputModule {
    2.     private PointerEventData m_InputPointerEvent;
    3. }
    that would be enough.

    Or, if there was an IDragHandler that doesn't require dragging (i.e. pressing the mouse button) ...
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Well, actually, accessing m_InputPointerEvent; wasn't the way but I now have my own implementation of StandaloneInputModule that does what I need.