Variable Not Changing In Method

So i assign this variable:

public string PotionCarry = "None";

And use it like this in a method here:

public void SetCarryPotion(string Potion)
    {   
        if(PotionCarry == "None")
        {
            PotionCarry = Potion;
            print("Transfer");
        }
        print(PotionCarry);
    }

This method is in the same script, and i have checked that when triggered “Transfer” is printed to the console. These are the only mentions of PotionCarry, so what is happening and how can i fix it?
Thanks!

Edit:
looked through my code in the trigger function calling the setcarrypotion() and it’s because i set the variable (which then would be set as PotionCarry) to none at the start of the function. facepalm

Sorry for being stupid and wasting your time,

Random noob

Well I’m not entirely sure what you are trying to accomplish, if you showed a pic of the log it would be much more informative. What do you mean by what is happening and how do I fix it? If you mean why is it only printing transfer and setting the variable once, that is because that will only happen if the variable equals “None”. As a side note you should also use String.Compare to compare 2 strings.

Why did you print an unrelated string, when you could have printed Potion??
That would give further information on what string the SetCarryPotion method is trying to set the variable PotionCarry to be.

Do This.

    public string PotionCarry = "None";


    private void Start()
    {
        SetCarryPotion("NewPotionCarry");
    }


    public void SetCarryPotion(string Potion)
    {
        if (PotionCarry == "None")
        {
            PotionCarry = Potion;
            print("Transfer");
        }
        print(PotionCarry);
    }