Why would this snippet run twice?

I have put this code for a button in my game:

if(Input.GetMouseButtonUp(0))
		{
			if(ButtonArea.Contains(MousePos)  Time.timeSinceLevelLoad - TimeSinceLastClick > 2f);
			{
				TimeSinceLastClick = Time.timeSinceLevelLoad;
				ConstObject.ShowButtons = !ConstObject.ShowButtons;
				print ("test");
			}
		}

For some odd reason, every time it’s clicked it prints out test twice and turns the bool to the opposite, then back. Even if I take out the TimeSinceLastClick like this:

if(Input.GetMouseButtonUp(0))
		{
			if(ButtonArea.Contains(MousePos));
			{
				ConstObject.ShowButtons = !ConstObject.ShowButtons;
				print ("test");
			}
		}

It will still print twice, I originally thought that for some reason GetMouseButtonUp was running for 2 scenes, however the time should have fixed that. Also if I make the if statement all one line like this:

if(ButtonArea.Contains(MousePos)  Time.timeSinceLevelLoad - TimeSinceLastClick > 0.5f);
		{
			TimeSinceLastClick = Time.timeSinceLevelLoad;
			ConstObject.ShowButtons = !ConstObject.ShowButtons;
			print ("test");
		}

test is printed out constantly. I have no idea what’s going on here, any suggestions?

You likely have two of the object in the scene, assuming that code resides in Update or OnGUI.

Otherwise you are likely calling the function that code is located in twice.

There is only one instance of the code in the scene, on the camera (the only object in the scene). I’ve also had a few other bugs, like sometimes I’ll have a public int set to 5, and if I Change it in the editor to 10, it will revert to 5 when I run the game.

What method does the code snipet exist in?
print some debugging at the start of it. This will show you if it is being called twice, and why (by looking at the stack trace)

So I know this was posted a while ago, but I realized my error now and the stupidity of it. The snippet with Input.GetMouseButtonUp(0) was contained in the OnGUI function. For anyone else having similar issues, OnGUI runs twice every frame, and since Input is only updated once per frame the GetMouseButtonUp was registered twice by OnGUI.