Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Mouse position seems to be in screen pixels, not game window pixels.

Discussion in 'Input System' started by MechaWolf99, Jun 1, 2020.

  1. MechaWolf99

    MechaWolf99

    Joined:
    Aug 22, 2017
    Posts:
    292
    The pixel coordinates give by Mouse.current.position.Readvalue() (And also from just using the action) seems to be in screen space of the monitor, and not in game window pixels.

    So 0, 0 is the bottom left corner of my monitor, ad not of the game window.
    The old Input.mousePosition, gave pixels of the game window.

    This is in 2019.3.15f1, with input system 1.0.0.
    Is this intentional? If so, how do I get pixels of the game window?
     
  2. Zaine7673

    Zaine7673

    Joined:
    Feb 15, 2018
    Posts:
    238
    I would also like to know how we can achieve this :)
     
  3. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    10,048
    I believe something is wrong with your setup then.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.InputSystem;
    3.  
    4. public class MouseRead : MonoBehaviour
    5. {
    6.     void Update()
    7.     {
    8.         if (Mouse.current.leftButton.wasPressedThisFrame)
    9.         {
    10.             Debug.Log(Mouse.current.position.ReadValue());
    11.         }
    12.     }
    13. }
    14.  
    answer.PNG
     
  4. Zaine7673

    Zaine7673

    Joined:
    Feb 15, 2018
    Posts:
    238
    I fixed my issue by applying a scale vector processor - somehow it has made the movement normal. like it used to be with the old system :)