How to find the mouse position in Unity using the New Input System

Viewed 10054

How can I find the mouse position in Unity? I am using the new Input System and I've already tried

InputDevice mouse = Mouse.current;

Ray ray = camera.ScreenPointToRay(mouse.position);

, but it didn't work. Anyone?

1 Answers

use this:

Ray ray = camera.ScreenPointToRay(Mouse.current.position.ReadValue());
Related