So I have a simple script, It works, but it’s in an update function. I’m not exacly sure how to create my own function… So could some one help show how to make it into its not called every frame and only called when needed.
static var electricityExp = 0;
var neededElectricity = 100;
static var electricity = 1;
function Update(){
if(electricityExp >= neededElectricity){
earth +=1;
//added effects...
neededElectricity += neededElectricity * 1.8;
}
}