title: Making an Int increase every second by x value
body: <p>I'm making a game similar to the 2013 style Cookie Clicker. I'm stuck with making the auto generate over time script. I want to be able to access a script that makes "Muffins" automatically.</p>
  
  <p>I've tried to make the script multiple times but I can't seem to get the muffin count to change.</p>
  
  <pre><code>    public bool MakingMuffins = false;
      public static int MuffinIncrease = 1;
      public int InternalIncrease;
  
      void Update () {
          InternalIncrease = MuffinIncrease;
          if (MakingMuffins == false)
          {
              MakingMuffins = true;
              StartCoroutine(MakeTheMuffin());
          }
      }
  
      IEnumerator MakeTheMuffin ()
      {
              GlobalMuffins.MuffinCount += InternalIncrease;
              yield return new WaitForSeconds(1);
              MakingMuffins = false;
  
      }
  }
  
  </code></pre>
  
  <p>and my other main file to start the method.</p>
  
  <pre><code>public void StartAutoMuffin()
      {
          if (InternalPlayerMuffins &gt;=bakerycost){
          playSound.Play();
          StartBakery.SetActive(true);
          InternalPlayerMuffins -= bakerycost;
          bakerycost *= 2;
          turnOffButton = true;
          themps += 1;
          thelevel += 1;
          }else{
              Debug.Log("Cant do anything");
          }
      }
  </code></pre>
  
  <p>StartBakery is a Game Object that should start the auto make after I press the button. It is set inactive as default.</p>
  
  <p>Here is more code from my main script to help understand.</p>
  
  <pre><code>using System;
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class GlobalGameMechanics : MonoBehaviour
  {
      public static bool turnOffButton = false;
      public AudioSource muffinSound;
      public AudioSource playSound;
      public static int GlobalPlayerDiamonds;
      public int InternalPlayerDiamonds = 1200;
      public GameObject PlayerDiamondDisplay;
      public GameObject TotalMPS;
      public GameObject Cost;
      public GameObject Level;
      public GameObject MPS;
      public GameObject FakeCost;
      public GameObject FakeLevel;
      public GameObject FakeMPS;
      public int InternalPlayerMuffins = 15;
      public int bakerycost = 25;
      public int thelevel = 0;
      public int themps = 0;
      public int currentMuffins;
      public GameObject ShopPanel;
      public GameObject fakeButton;
      public GameObject realButton;
      public GameObject StartBakery;
  
  
      void Start()
      {
  
      }
  
      void Update()
      {
  
         GlobalPlayerDiamonds = InternalPlayerDiamonds;
         PlayerDiamondDisplay.GetComponent&lt;Text&gt;().text = "" + InternalPlayerDiamonds;
         TotalMPS.GetComponent&lt;Text&gt;().text = "/Sec " + themps;
  
         GlobalMuffins.MuffinCount = InternalPlayerMuffins;
         Cost.GetComponent&lt;Text&gt;().text = "" + bakerycost;
         Level.GetComponent&lt;Text&gt;().text = "Level " + thelevel;
         MPS.GetComponent&lt;Text&gt;().text = "MPS " + themps;
  
         FakeCost.GetComponent&lt;Text&gt;().text = "" + bakerycost;
         FakeLevel.GetComponent&lt;Text&gt;().text = "Level " + thelevel;
         FakeMPS.GetComponent&lt;Text&gt;().text = "MPS " + themps;
  
          currentMuffins = InternalPlayerMuffins;
          if (currentMuffins &gt;= bakerycost)
          {
              fakeButton.SetActive(false);
              realButton.SetActive(true);
          }
          if (turnOffButton == true)
          {
              realButton.SetActive(false);
              fakeButton.SetActive(true);
              turnOffButton = false;
          }
  
       }
  </code></pre>
  
  <p>So far I have created 1 button that I want to increase the "InternalPlayerMuffins" By 1 every second. And then I want to have Button 2 to increase by +5 /sec. I'm just having trouble and been stuck for a few days.</p>
  
  <p>I cant make the muffins increase at all on its :/</p>