// Jimmy Vegas Unity Tutorial // These scripts will auto create cookies using System.Collections; using System.Collections.Generic; using UnityEngine; public class AutoCookie : MonoBehaviour { public bool CreatingCookie = false; public static int CookieIncrease = 1; public int InternalIncrease; void Update () { InternalIncrease = CookieIncrease; if (CreatingCookie == false) { CreatingCookie = true; StartCoroutine(CreateTheCookie()); } } IEnumerator CreateTheCookie () { GlobalCookies.CookieCount += InternalIncrease; yield return new WaitForSeconds(1); CreatingCookie = false; } } using System.Collections; using System.Collections.Generic; using UnityEngine; public class PurchaseLog : MonoBehaviour { public GameObject AutoCookie; public void StartAutoCookie() { AutoCookie.SetActive(true); } }