How do I reference an incremented int with one button, that was incremented from another button?

So, I have a button that increments an int by 1 each click, using:

    int EffectNumberCounter(int tempEffectNumber)
    {
        int effectNumberFinal;
        effectNumberFinal = tempEffectNumber + 1;    
        return effectNumberFinal;  
    }

And then the button:

public void btnAddEffectClick()
    {
        effectNumber = EffectNumberCounter(effectNumber);
    }

I want to reference the result of effectNumber, whatever it happens to be at the time, when I click the other button, which I have dubbed btnRerollEffectClick, by using if effectNumber = 1 (ETC ETC ETC), without losing the stored value of effectNumber. Unfortunately it keeps returning to 0.
What would be the way to do this?

i think you want an int from one function and use it as a reference in another. if my interpretation isn’t correct sorry to bother you.

private Count;

int EffectNumberCounter(int tempEffectNumber)

 {
        if (Count  > 0  // yourcondition){
     int effectNumberFinal;
     effectNumberFinal = tempEffectNumber + 1;    
     return effectNumberFinal;  
 }

else
//Dothis

}

public void btnAddEffectClick()

 {
     effectNumber = EffectNumberCounter(effectNumber);
     Count =effectNumber;
 }