Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mouse cursor disappear!

Discussion in 'Scripting' started by leegod, Aug 31, 2011.

  1. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,472
    When I load new scene when playing game (consists of 2 scenes), new scene loaded without mouse cursor.

    If I hit 'esc' key, then mouse cursor appear.

    I don't do any code, but just this at function Awake(),

    Screen.showCursor = true;


    But I meet the exact opposite result. Why?


    And if I make build standalone, and play it, then even if I hit 'esc' key, mouse cursor does not appear.


    Thanks.
     
    Last edited: Aug 31, 2011
  2. RingOfStorms

    RingOfStorms

    Joined:
    Oct 23, 2010
    Posts:
    584
    If you have any code please post it, as it could be a problem there, and we can't see it :)

    use the code tags!
     
  3. GargerathSunman

    GargerathSunman

    Joined:
    May 1, 2008
    Posts:
    1,571
    Sounds to me like the scene has the built-in FPS Controller, as I remember it using a forced lockCursor on program start, thus negating any showCursor calls.

    I'd suggest either changing the script so that it doesn't show/hide the cursor or creating your own scripts that do the same thing.
     
    au-relius likes this.
  4. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,472
    Thx you are right. I used M2H's guide's some example's game setup script and it used Screen.lockcursor. I didn't know this function so I didn't found myself. But your 1 word save me.