- Home /
Question by
unity_GfuHMVeiSEbIvQ · Oct 16, 2020 at 09:42 PM ·
uiinputbuttonmouse
Can't interact with UI when using a virtual mouse,
I have created a "virtual" mouse through the new input system using:
Mouse RemoteMouse = InputSystem.AddDevice<Mouse>()
I create a new mouse state using:
pos = new Vector2Int(x, y);
newMouseState = new MouseState
{
position = pos,
delta = pos - m_prevMouseState.position,
buttons = m_prevMouseState.buttons
};
newMouseState.WithButton(button, true);
And finally update its position using:
InputSystem.QueueStateEvent(RemoteMouse, newMouseState);
m_prevMouseState = newMouseState;
This all works fine for the most part. I am able to utilize this mouse as I would a normal mouse, however I am unable to interact with UI. When the virtual mouse is hovering over a button the button doesn't transition to a hovered state, and when I click on a button or an input field nothing happens. EventSystem.current.IsPointerOverGameObject()
always returns null
.
Is this a limitation in the new input system? If not, any help would be appreciated.
I know that I could probaby work around this issue by using Mouse.WarpCursorPosition()
, however I am unable to do so for my use case.
,
Comment