Hello,
with the script XRUIInputModule as EventSystem and with a script that inherit from IPointerClickHandler and when i press right click on the mouse, it always return false however left click button is set to true.
It works when i use InputSystemUIInputModule.
Thank you for your help.
Unity 2020.3.19f1
XR Interaction Toolkit 1.0.0-pre.6
Regards,
1 Like
No one else is affected by this bug ?
Thank you.
very annoying bug…
If Unity Technologies could fix it…
Hello, i tried version 1.0.0-pre8 and version 2.0.0-pre5 the bug still exists.
It is possible to have an answer ?..
public void OnPointerClick(PointerEventData eventData)
{
if (eventData.button == PointerEventData.InputButton.Left)
// Always return true even if i click right button.
internal void ProcessMouse(ref MouseModel mouseState)
{
if (!mouseState.changedThisFrame)
return;
var eventData = GetOrCreateCachedPointerEvent();
eventData.Reset();
mouseState.CopyTo(eventData);
eventData.pointerCurrentRaycast = PerformRaycast(eventData);
// Left Mouse Button
// The left mouse button is 'dominant' and we want to also process hover and scroll events as if the occurred during the left click.
var buttonState = mouseState.leftButton;
buttonState.CopyTo(eventData);
eventData.button = PointerEventData.InputButton.Left; // ADD CUSTOM
ProcessMouseButton(buttonState.lastFrameDelta, eventData);
ProcessMouseMovement(eventData);
ProcessMouseScroll(eventData);
mouseState.CopyFrom(eventData);
ProcessMouseButtonDrag(eventData);
buttonState.CopyFrom(eventData);
mouseState.leftButton = buttonState;
// Right Mouse Button
buttonState = mouseState.rightButton;
buttonState.CopyTo(eventData);
eventData.button = PointerEventData.InputButton.Right; // ADD CUSTOM
ProcessMouseButton(buttonState.lastFrameDelta, eventData);
ProcessMouseButtonDrag(eventData);
buttonState.CopyFrom(eventData);
mouseState.rightButton = buttonState;
// Middle Mouse Button
buttonState = mouseState.middleButton;
buttonState.CopyTo(eventData);
eventData.button = PointerEventData.InputButton.Middle; // ADD CUSTOM
ProcessMouseButton(buttonState.lastFrameDelta, eventData);
ProcessMouseButtonDrag(eventData);
buttonState.CopyFrom(eventData);
mouseState.middleButton = buttonState;
mouseState.OnFrameFinished();
}
it seems to do the tricks…
Thank you unity team after 2 months of waiting.
IMO I always hated that the right mouse button counts as a click event. I mean literally the basics of using a mouse is that you get taught to use the left mouse button to click and to drag. Right mouse button is for context menu’s not clicks.
Either way, yeah when you encounter bugs that are easily solved… it is easier to just pull the XR UI Toolkit into the packages folder and fix it yourself.
Though when you encounter a bug, always report it through the bug report in Unity. It is more effective than here on the forum. Of course you can always do both and link the case here on the forum which then might get picked up.
I had a minor bug where the Line Visual was always being stopped despite its setting turned off. The fix? replacing a || with && on a line of code.
Silly little oversights like these break features and it takes them quite a long time to push the fix in the next release.
i am not an unity employee.
yes so? It doesn’t mean you cannot fix it yourself when you need it to work.
Like I said, it is easier to move the package into the packages folder to make it a development package and fix it yourself. Than to wait months for a fix because Unity ain’t quick on updating XRI.
These packages aren’t dll’s they are readable and editable.