Make a Cursor Disappear? (9936)

How would I write a script to make a cursor disappear when I press a key on my keyboard and then reappear when I press that key again?

1 Answer

1

Hi,

Try something like this ( javascript )

function Update () {
  if ( Input.GetKeyDown ("space") ){
    Screen.showCursor = !Screen.showCursor;
  }
}

Hope it helps,

Jean

excuse me which gameobject would i put the script in?

Yo could put this on any game object in any scene and it would work (in that scene of course).

I put this in a empty(gameobject>>>Create Empty) and it didn't work for me BTW i changed the space to a c does it have to be c Thanks for responding so quickly :)

thanks it worked

No Problem!