Comment exécuter un code une seule fois dans la fonction de mise à jour dans Unity (méthode maudite)

sealed class CodeState {
	public string stateName;
    public CodeState(string stateName) {
    	this.stateName = stateName;
    }
}
public static class VarsNStuff {
	public static List<CodeState> states = new List<CodeState>() {new CodeState("Finished"),
    	new CodeState("Incomplete");
    }
}
private class Test : MonoBehaviour {
	private CodeState state = VarsNStuff.states[1];
    
    public override void Update() {
    	if (this.state != VarsNStuff.states[0]{ 
        	//Do code.
            foreach (dynamic state in VarsNStuff.states) {
            	if (this.state != state) {
                	this.state = state;
                    break;
                } }
        }
    }
}
Hilarious Hyena