Need help with the eventdata pointer.id (New Input system)

Hey all!
I’ve been converting my whole project into using the new Input-System, but now I have been struggling with this issue for a day now. It’s really bugging me.

I have an inventory system which uses the event system and the OnPointerDown method. It used to work just fine with the old input system, but after implementing the new input system, it can’t tell the difference on which mouse button I press. The eventdata.pointer.id is always = 2 no matter which mouse button I press.

It should be like: Left Click = -1, Right Click = -2 and Middle click = -3 etc.

I’ve tried the same procedure in a different project as well, but with the same result.

198093-issuewitheventdata2.jpg

I encountered the same issue in Unity-2021-3-LTS.25f1. A workaround I found on the forums was to reference the eventData.button.ToString(). The button is correctly differentiating left/middle/right clicks.

If there is a reason the pointer ids are all returning 2 due to configuration though I would appreciate anyone’s answer. Otherwise looks like a bug.

Same for me. Also when I build to android and make a touch the pointerId is something like 83886123 or another big number but nothing like 0, 1, 2… Though multiple touches still differ by 1.

It can be fixed by accessing ExtendedPointerEventData. I now use func to convert new InputSystem pointer event data to old one like that:

private int GetValidPointerId(PointerEventData eventData)
{
	ExtendedPointerEventData extendedEventData = eventData as ExtendedPointerEventData;
	switch (extendedEventData.pointerType)
	{
		case UIPointerType.MouseOrPen:
			return -(int)extendedEventData.button;
		case UIPointerType.Touch:
			return extendedEventData.touchId - 1;
		default:
			throw new ArgumentOutOfRangeException($"Can't handle pointer type {extendedEventData.pointerType}");
	}
}