- Home /
Unity 4.3.4 2D mode, hide mouse pointer only works on half of the screen
I am starting Unity3D today, but I am familiar with C# though.
I am following a 2D game tutorial at Udemy.com, and I am trying to hide the mouse cursor.
So I did this,
// Use this for initialization
void Start()
{
Screen.showCursor = false;
}
// Update is called once per frame
void Update()
{
Screen.showCursor = false;
}
But the mouse cursor is hidden at about half of the screen only (on the left side). If I move my mouse to the right the mouse pointer appears, if I move back to the left the mouse pointer disappears.
I am thinking this must be related to the way I setup my camera or view or something, any ideas what I should look at?
Update 1: Looks like the mouse is hidden at certain rectangle area of the screen but not the others. My initial description (half of the screen) is not accurate.
Update 2: I know what is happening now, it depends on the screen resolution I select!. If I select 800x600 then only a certain portion of the screen will the mouse get hidden. If I select Free Aspect then almost all the screen area will work as intended. See screenshot.
But I don't know whether it is a bug in Unity game player or my code. I assume it is a bug in the player since I have not done much coding at all.
Search the project for other areas that have Screen.showCursor = true; and make sure there isn't something else turning it on.
ThePunisher, the only code I have is the above. The rest are just game objects. I updated my question to reflect my finding so far.
Can you take a screenshot? I'm running the same code you are and I am not able to reproduce anything similar.
I include a screenshot now. It is due to the screen resolution I selected. So is this a bug in the player or I need to fix something in my code to make it work correctly?
Don't think I've ever seen anything like that. Have you tried making a standalone build to ensure it works correctly there? Also, what happens if you don't maximize on play (top right)?