help me. i’ve been trying to get a score from another script, but when i start game and press button, which activates the script, i get that error in the title. Also the error says: “ExitClassic.EXIT () (at Assets/ExitClassic.cs:55)” the code:
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
public class ExitClassic : MonoBehaviour
{
public GameObject dayEndBG;
public GameObject dayEndС;
public GameObject dayEndT;
public GameObject dayEndT1;
public GameObject dayEndT2;
public GameObject OrigCanvas;
public Text daysL;
public Text coinsN;
private SpriteRenderer bgRend;
private CanvasGroup bgRend1;
private int d = 3;
private int cD = 1;
public int qN = 100;
private float desiredAlpha = 1f;
private float currentAlpha = 0f;
private bool dayEnd = false;
private bool fdI = false;
private bool fdO = false;
public ScoreClassic script;
void Start()
{
script = OrigCanvas.GetComponent<ScoreClassic>();
bgRend = dayEndBG.GetComponent<SpriteRenderer>();
bgRend1 = dayEndС.GetComponent<CanvasGroup>();
daysL.text = "Quote: " + d.ToString() + " days";
coinsN.text = qN.ToString() + " coins";
}
void Update()
{
}
public void EXIT()
{
Debug.Log("left");
dayEnd = true;
dayEndС.SetActive(true);
Invoke("ShowCubik", 3);
Invoke("TextShow", 5);
if(script.Scr >= qN && cD == 3){
Invoke("TextShowW", 8);
cD = 1;
} else {
Invoke("TextShowL", 8);
cD = 1;
}
if(script.Scr == 0){
Debug.Log("is 0 test");
}
Invoke("CleanT", 11);
Invoke("HideCubik", 12);
cD++;
}
private void TextShow()
{
dayEndT.SetActive(true);
}
private void TextShowW()
{
dayEndT.SetActive(false);
dayEndT1.SetActive(true);
}
private void TextShowL()
{
dayEndT.SetActive(false);
dayEndT2.SetActive(true);
}
private void CleanT()
{
dayEndT.SetActive(false);
dayEndT1.SetActive(false);
dayEndT2.SetActive(false);
}
private void ShowCubik()
{
dayEndBG.SetActive(true);
}
private void HideCubik()
{
dayEndBG.SetActive(false);
}
}