如何使用新输入系统在 Unity 中查找鼠标位置

gal*_*dev 5 c# unity-game-engine

Unity中如何找到鼠标位置?我正在使用新的输入系统并且我已经尝试过

InputDevice mouse = Mouse.current;

Ray ray = camera.ScreenPointToRay(mouse.position);
Run Code Online (Sandbox Code Playgroud)

,但没有成功。任何人?

Mah*_*hsa 1

用这个:

Ray ray = camera.ScreenPointToRay(Mouse.current.position.ReadValue());
Run Code Online (Sandbox Code Playgroud)

  • 鼠标不存在 (4认同)