Changing Values

okay so what im trying to do is change values from one script to another for exaple if on one script a value equals 3 then i want to go to another script and change its value to 3 when its original value is 4. SO i would decrease its value by 1, the code that i have would decrease its value by 1 but 1 every sec unless i turn the script off. SO what im trying to ask is if there any way to just decrease another scripts value by only 1 not 1 every sec. heres my script

if (curAction >= 3){

MageCounter2 mc = (MageCounter2)Mage.GetComponent(“MageCounter2”);

mc.AdjustCurrentAction(-1)

}

It’s hard to give a great answer without learning more about your project. One technique that might be helpful is caching your curAction so that you only call the mage script once for each time the action changes. For instance:

	int lastCurAction = -1;
	
	void UpdateOrWhatevs()
	{
		if (curAction != lastCurAction)
		{
			if (curAction >= 3){
	
				MageCounter2 mc = (MageCounter2)Mage.GetComponent("MageCounter2");
				
				mc.AdjustCurrentAction(-1);
			}	
			
			// Presumably you might have other cases here
			
			lastCurAction = curAction;
		}
	}

This way, when the curAction changes, you will then call AdjustCurrentAction() only one time. Does that accomplish your goal?