- 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)?
Your answer
Welcome to Unity Answers
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Follow this Question
Related Questions
Unity 2D: move towards mouse and through mouse 1 Answer
Get object at mouse position? (UI) 0 Answers
c# unity area selection 0 Answers
Character moving to mouse in third person camera 0 Answers
Mouse rotation, jerky movement 1 Answer