
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
게임매니져 코드에 에러가 나왔습니다
밑에첫번째 유니티 에러캡쳐화면이고 2번째는 게임매니져 코드 입니다
초보이니 게임매니져코드 좀 올려주시고 어떤부분에서 에러가나왔는지 상세히 설명 부탁드립니다.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public static GameManager Instance;
public GameObject square;
public GameObject endPanel;
public Text timeTxt;
public Text nowScore;
public Text bestScore;
public Animator anim;
bool isPlay = true;
float time = 0.0f;
string key = "bestScore";
private void Awake()
{
if(Instance == null)
{
Instance = this;
}
}
void Start()
{
Time.timeScale = 1.0f;
InvokeRepeating("MakeSquare", 0f, 1f);
}
// Update is called once per frame
void Update()
{
if (isPlay)
{
time += Time.deltaTime;
timeTxt.text = time.ToString("N2");
}
}
void MakeSquare()
{
Instantiate(square);
}
public void GameOver()
{
isPlay = false;
anim.SetBool("isDie", true);
Invoke("TimeStop", 0.5f);
nowScore.text = time.ToString("N2");
// 최고점수가 있다면
if (PlayerPrefs.HasKey(key))
{
float best = PlayerPrefs.GetFloat(key);
// 최고점수 < 현재 점수
if (best < time)
{
// 현재 점수를 최고 점수에 저장한다.
PlayerPrefs.SetFloat(key , time);
bestScore.text =time.ToString("N2");
}
else
{
bestScore.text = best.ToString("N2");
}
}
else
{
PlayerPrefs.SetFloat(key, time);
bestScore.text = time.ToString("N2");
}
endPanel.SetActive(true);
}
void TimeStop()
{
Time.timeScale = 0.0f;
}
}
