NullReferenceException: Object reference not set to an instance of an object Clicker.Update () (at Assets/scripts/Clicker.cs:20) не понимаю где ошибка

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Clicker : MonoBehaviour
{
public int cookie;
private int cookieUp = 1;

private bool check = true;

public Text cookieText;
public GameObject ShopPan;


void Update()
{

    cookieText.text = "Cookie: " + cookie;
       
     
}

public void OnClickButton() {

    cookie += cookieUp;

}



public void OnClickShopPanelButton() {

    if (check == true)
    {

        ShopPan.SetActive(true);
        check = false;

    }
    else {

        ShopPan.SetActive(false);
        check = true;



    }


}


public void OnClickBuy()
{
    if (cookie >= 100)
    {
        cookieUp *= 2;
        cookie -= 100;

    }


}

public void isFirstAch() {

    if(cookie == 100)
    {
        cookie += 100;
        StartCoroutine(PasCookie());
        break;

    }

}

IEnumerator PasCookie()
{

    yield return new WaitForSeconds(1);
    cookie++;
    Debug.Log(cookie);
    PlayerPrefs.SetInt("cookie", cookie);
    StartCoroutine(PasCookie());
}


}

Ответы (0 шт):