I noticed that when calling Mouse.current.WarpCursorPosition() the cursor will move to the right position but InputSystem will report the old position until the next mouse event.
This is happening on:
Input System 1.0.0
Unity 2020.1.0b14
Windows 10
Thanks for pointing that out, but I’m aware of the documentation and it still fells like a bug.
See, the documentation states that “the position property will not update immediately but rather will update in the next input update”. This means that the position should be updated on the next frame’s Update, or isn’t that right?
Well that is not what I’m getting.
As I said, the position property is only updating after another mouse input event, In other words, the mouse pointer will - by default - only be warped to the target position after the mouse is physically moved or clicked.
You just highlighted it bold. When the input next updates. Update method and input update aren’t the same thing, the input doesn’t even need to update in the Update method.
But if you still feel it’s a bug, why don’t you report it instead of the forum? But again, it is documented behavior so…
This was driving me crazy too. I read the documentation and thought in the next frame update it would read the correct position, I didn’t understand it would only update on the next input event. Thanks @Garrafote for the heads up!
Position should be updating next frame / next update, I’ve checked and what we’re doing at warp is calling SetCursorPos / CGWarpMouseCursorPosition / SDL_WarpMouseInWindow / etc, and code relies on OS to report the new position as-it-would-be for normal user mouse movements, but maybe that is not happening at all.
Could you please report it as a bug (Help->Report bug) and we will take it from there. Thanks a lot!
This is still happening (at least in Editor). After you call Warp, it will not update the mouse position ever until you click (maybe just move) the mouse physically yourself.
@Garrafote 's fix is still working fine though. Thanks!