Trying to find a way to add a timer to my code and then continuously loop it with the timer. e.g Trying to craft items with a button click and then waiting 5 seconds for it to craft before it automatically begins to craft again and so on as long as I have the materials. Ive looked around on tutorials but havent been able to find what ive been looking for. This is the code I want to loop:
public double copper;
public double copperBar;
public double copperBarValue;
public double multiplier;
public void Start()
{
copperBar = 0;
copperBarValue = 5;
copper = 0;
multiplier = 1;
}
**public void FurnaceInteraction()
{
if (copper >= copperBarValue)
{
copper -= copperBarValue;
copperBar += 1 * multiplier;
}
}**
