Mouse.current.position reads the wrong value if mouse isn't moved at start of scene

Hello,

I’m learning Unity and decided to go with the Input System, so far everything have been easy enough but today I was trying to make the player to always look at the cursor on 2D so I added an action that gives me back the Mouse/Position, when I run the scene and don’t move the mouse at all, it always returns 0, 0 however. This happens even if I use Mouse.current.position.ReadValue().

I tried the same thing but with using Input.mousePosition instead and it returns the position of the mouse correctly even if I don’t move it at all.

Am I missing something?

Where do you call Mouse.current.position.ReadValue() ? In update ? It should be fine after the first frame

Yes, I’m calling it on Update and still get 0, 0 until the mouse moves

private void Update()
        {
        var pointingPosition = Mouse.current.position.ReadValue();
        Debug.Log(pointingPosition);
}

Maybe Mouse.current only gets set when there is the first input ?
Anyway, why would you need the position of the mouse if it did not move ?

I’m learning and want the weapon for the player always pointing in the direction that the mouse currently is at, it looks rather weird when the weapon stays dead in the middle when there is a mouse, just haven’t moved it yet.

Then, anyway your game won’t start in this scene, so when it will reach there, it will have mouse input, it shouldn’t be a problem IMO

Well, that’s actually a really good point that I honestly hadn’t thought about to be fair.