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. Dismiss Notice

Top of the game screen

Discussion in 'Scripting' started by Falcoshin, Apr 6, 2021.

  1. Falcoshin

    Falcoshin

    Joined:
    May 31, 2017
    Posts:
    168
    I just want to be perfectly clear, but this code should print "True" if I bring my mouse to the top of the game screen, right? If so then it's not and I don't know why.

    Code (csharp):
    1.  
    2.             if (Input.mousePosition.y >= Screen.height * 0.99f)
    3.             {
    4.                 print(true);
    5.             }
    6.  
     
  2. Falcoshin

    Falcoshin

    Joined:
    May 31, 2017
    Posts:
    168
    Nevermind. I solved it. Apparently the problem had to do with me checking Screen.width instead of Screen.height somewhere else in the code.