Make a float variable change when another variable changes?

Hello,

I am trying to change a float variable value when another variable changes like so:

public float minsMP1 = 0;
public float expMP1 = minsMP1 * 0.01;

where minsMP1 is changed upon a button click… The method of changing minsMP1 is OK, i got it but I cannot change the value of expMP1 when minsMP1 changes and it gives me the 'error CS0236: a field initializer cannot reference the nonstatic field,method or property ‘GameTime.minsMP1’.

Any ideas are appreciated :slight_smile:

public float minsMP1 = 0;
public float expMP1;

public void Update () {
     expMP1 = minsMP1 * 0.01;
}