Why not showing up

Hello.
I want to make a script in c# for showing up, and hiding cursor while using esc. I made it, it’s hiding at first use, but don’t want to show up again.Why is that?

using UnityEngine;
using System.Collections;

public class Cursor : MonoBehaviour
{
			void start()
			{
				Screen.showCursor = false;
			}

	void Update()
		{
				if ((Input.GetKeyUp (KeyCode.Escape)) && (Screen.showCursor=false))
				Screen.showCursor = true;

			else
			{
				if ((Input.GetKeyUp (KeyCode.Escape)) && (Screen.showCursor=true))
				{
					Screen.showCursor = false;
				}
			}
		}
}

Besides the fact you’re missing an equals (inside “if” you have to use “==” and not “=” else the compiler will assign the value and not check), anyway a better code will be (also take care of letter-case for the functions, it’s “Start” and not “start”):

void Start () 
{
	Screen.showCursor = false;
}

public void Update () 
{
	if (Input.GetKeyUp(KeyCode.Escape))
		Screen.showCursor = !Screen.showCursor;
}

It works now, thank you very much! :slight_smile: