- Home /
How to get Mouse input using the new Unity Input System
I've been learning how to use the new Input System, but I can't figure out how to handle mouse input. I want to have the camera rotate around the player, and to do that I need to get the X and Y of the mouse. In the old system it was already made for you, but I have no idea how to set that up in the new system. I can provide more info if needed.
Why dont you just use Input.mousePosition
? BTW -> UnityEngine.EventSystems.EventSystem.current.currentInput$$anonymous$$odule.input.mousePosition
is what you're looking for?
Answer by unity_2Vi4I6AinGsBeQ · Oct 29, 2020 at 06:59 AM
Starting from the Player Input component makes this easier. It provides some default input action mappings that give you Movement, Look, and Fire for free. After that, you just have to use one of the notification approaches (e.g., unity events, C# events, etc.) to string up the events to your mouse look script.
Answer by CyberGamer1907 · Oct 29, 2020 at 09:41 AM
you can use this method: Vector3 MousePosition; void Update() { MousePosition = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y,10f)); }
Your answer
Follow this Question
Related Questions
Need help on the 3ds max style camera control 0 Answers
Simple Object Dragging 0 Answers
Strange Camera Behavior on iOS - Runs perfect in Unity 0 Answers
Move camera with mouse (2D) 1 Answer