Hiding AND unhiding the cursor

I thought this would be fairly simple. I’m new to scripting but I thought I could do this on my own, I can’t.

I want my cursor visible all the time, except when I hold a mouse button down.

I hid my cursor by using Screen.showCursor = false, it only hides when I click and orbit my character.

That part worked great, but I wanted it to come back after I let go of the button, but it’s not working. It stays gone permanently.

I tried things like

if Input.GetMouseButtonUp
Screen.showCursor = true

and other things but I’m getting nowhere and nothing but error messages =\

if (Input.GetMouseButtonUp(0)) {
  Screen.showCursor = true;
}

The above should work fine. What error messages are you getting?

Thanks for replying, this is what I have in my script.

if (Input.GetMouseButtonDown(1)) {
	 Screen.showCursor = false;
}

It hides the cursor just fine when I click the right mouse button, but after I let go it doesn’t come back.

I tried adding something like else GetMouseButtonUp to make it come back but it’s not working. My noobness at scripting is most certainly at fault here, I’m just not sure where to put everything yet.

You can’t use else with a condition. Just set up the Up as a second if and you should be fine.

Okay, well I set it up like so:

function start (){

    if (Input.GetMouseButtonDown(1)) {
	 Screen.showCursor = false;
	 }
    if (Input.GetMouseButtonUp(1)) {
     Screen.showCursor = true;
    }
}

But now it’s not doing anything, the cursor just stays visible.

This code has to be in the Update method (the Start method only ever gets called once when the object is initialised).

Argh! It works perfectly now.

Thanks so much >.<