When i try to use the following code to convert EventSystem.current to pointerEventData
PointerEventData pointer = new PointerEventData(EventSystem.current);
pointer shows as null when stepping through the code with monodevelop debugger yet Debug.Log shows:
Pointer: <b>Position</b>: (0.0, 0.0)
<b>delta</b>: (0.0, 0.0)
<b>eligibleForClick</b>: False
<b>pointerEnter</b>:
<b>pointerPress</b>:
<b>lastPointerPress</b>:
<b>pointerDrag</b>:
<b>Use Drag Threshold</b>: True
UnityEngine.Debug:Log(Object)
VRInputManager:CheckMouseDrag() (at Assets/VRInputManager/VRInputManager.cs:275)
VRInputManager:Update() (at Assets/VRInputManager/VRInputManager.cs:104)
EventSystem.current returns valid data when stepping through the code with monodevelop debugger and Debug.Log shows:
EventSystem.current: <b>Selected:</b>
<b>Last Selected:</b>
<b>Pointer Input Module of type: </b>UnityEngine.EventSystems.StandaloneInputModule
<B>Pointer:</b> -1
<b>Position</b>: (179.0, 170.0)
<b>delta</b>: (33.0, 1.0)
<b>eligibleForClick</b>: True
<b>pointerEnter</b>:
<b>pointerPress</b>:
<b>lastPointerPress</b>:
<b>pointerDrag</b>:
<b>Use Drag Threshold</b>: True
<B>Pointer:</b> -2
<b>Position</b>: (179.0, 170.0)
<b>delta</b>: (33.0, 1.0)
<b>eligibleForClick</b>: False
<b>pointerEnter</b>:
<b>pointerPress</b>:
<b>lastPointerPress</b>:
<b>pointerDrag</b>:
<b>Use Drag Threshold</b>: True
<B>Pointer:</b> -3
<b>Position</b>: (179.0, 170.0)
<b>delta</b>: (33.0, 1.0)
<b>eligibleForClick</b>: False
<b>pointerEnter</b>:
<b>pointerPress</b>:
<b>lastPointerPress</b>:
<b>pointerDrag</b>:
<b>Use Drag Threshold</b>: True
UnityEngine.Debug:Log(Object)
VRInputManager:CheckMouseDrag() (at Assets/VRInputManager/VRInputManager.cs:274)
VRInputManager:Update() (at Assets/VRInputManager/VRInputManager.cs:104)
What am i missing?
i’m using pointer with
ExecuteEvents.Execute(selectedObject,pointer,ExecuteEvents.dragHandler);
to trigger
#region IDragHandler implementation
public void OnDrag (PointerEventData eventData){
Debug.Log("Dragging: "+eventData.selectedObject.name);
}
#endregion