This function isnt working with the right number and I dont know why

So I have this:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;



public class ShopManager : MonoBehaviour

{

public int buyAmount;



Clicker clicker;



private void Awake()

{

clicker = GetComponent<Clicker>();

}



public void BuyAmountChanger()

{

if (buyAmount == 1)

{

buyAmount = 10;

}

else if (buyAmount == 10)

{

buyAmount = 100;

}

else if (buyAmount == 100)

{

buyAmount = 1;

}



}



public void AddClicker()

{

clicker.AddObject(buyAmount);

}

}

The problem with this is the last few lines. clicker.AddObject(buyAmount); only adds 1 to the object amount no matter what buyAmount is. Ive tried to use Debug.Log(buyAmount) to print what buyAmount is when I add it but that doesnt seem to work as it doesnt show anything at all, it just doesnt output.

If this matters I also have this.

using System.Collections;

using System.Collections.Generic;

using UnityEngine;



public class Clicker : MonoBehaviour

{

public string objectName = "Clicker";



public int objectAmount;



public int idlerCost = 1;

public int nextIdlerCost;



public void AddObject(int AddAmount)

{

objectAmount += AddAmount;

//Debug.Log("You now have " + objectAmount + " Clickers!");

}



public void SubObject(int SubAmount)

{

objectAmount -= SubAmount;

}



public void CalcNextIdlerCost()

{

nextIdlerCost = (int)(idlerCost * 1.2);

}



public void NewIdlerCost()

{

idlerCost = nextIdlerCost;

}



public void AddGold()

{



}

}

Sounds like the code isn’t being called, then. Seems like maybe you think it’s being called, but it’s not. Either learn to use the debugger and set breakpoints liberally, or just add tons of Debug.Log statements to all interesting lines of code to see if it’s hitting them, and print what values things have.