unable to convert EventSystem.current to pointerEventData

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

You tried adding:
using UnityEngine.EventSystems;
on top of the script? You might also want to check out Unity official tutorial on new GUI and look up what should class inherit

seems like PointerEventData.position is protected and can’t be modified.

PointerEventData is generated for the Callback which requires it, in the same way as the Collision info is populated during OnCollisionEnter or the way Raycast Hitinfo is populated upon a Raycast.

Here’s a JS template for using PointerEventData

#pragma strict

import UnityEngine.UI;
import UnityEngine.EventSystems;

public class SomeClass extends MonoBehaviour implements IPointerDownHandler, IDragHandler, IPointerUpHandler
{	
	function OnPointerDown(data : PointerEventData)
	{
	}
	function OnPointerUp(data : PointerEventData)
	{
    }
    function OnDrag(data : PointerEventData)
	{
    }
}

In order to extract the information to use outside the Callback function you need to make a Class variable to store the information in after it has been generated. I am unsure if there are any other ways to implement the PointerEventData so this is not definitive.

As far as I understand, Event.current is actually UnityGUI call so may only work inside OnGUI.