If(x >= y && a >= c) not working

Basically what is happening is I want something to happen only when the player has enough rescources to build the building here is essentially what my code looks like

Public void Sawmillplaced ()
	If (money >= 299 && energy >= 4 && workers >= 1)
		Instantiate (sawmill, prefabpad.transform.position, Quaternion.identity);
		sawmillbutton.text = " insufficient resources";
		Timer = true;

and this is repeated for the other buidings I’m somewhat new to unity but I still kinda know what I’m doing

There is nothing wrong with your if statement, try throwing a Debug.Log(“Enough resources, placing Sawmill”); in the if statement. if you get the Debug.Log in your console, it means something is wrong with your prefab instantiate or you are not reading variables money, energy or workers.

The issue for some odd reason was that the integers we’re not static I randomly inserted it and everything works that’s for all the help, cheers, Eli.

should be if, not If, you code shouldn’t actually execute with capital If

check if you variables are agreeing too. I’ve had this happen before. Your varibales for money resources and workers may be floats instead of ints

so if you have it written like this when you declare a variable

private (or public) float workers = 0f;

but then you wrote your if statement without the “f” unity won’t allow it to communicate. Floats remain floats and ints ints

that might not be it but i don’t know what your declared variables are.