
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
질문 해결 버튼을 잘못 눌러서 다시 질문드립니다..
다시하기 버튼이 동작하지 않아요.
GamaManager.cs에 Retry() 함수를 추가해보라고도 하셔서 추가해봤는데 그래도 동작하지 않고 있어요.

작성한 코드 및 에러 메세지
GamaMager.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public static GameManager Instance; //싱글톤
public GameObject square;
public Text timeTxt; //unityengine.ui 필요
public GameObject EndPanel;
public Text NowScore;
bool isPlay = true;
float time = 0.0f;
private void Awake() //싱클톤
{
if(Instance == null)
{
Instance = this;
}
}
// Start is called before the first frame update
void Start()
{
Time.timeScale = 1.0f;
InvokeRepeating("MakeSquare",0f,1);
//반복 생성은 InvokeRepeating
//그 안에 함수 만들어 넣어주고
//바로 실행은 0f
//주기는 1초마다
}
// Update is called once per frame
void Update()
{
if (isPlay)
{
time += Time.deltaTime;
timeTxt.text = time.ToString("N2"); //숫자이기 때문에 스트링으로 변환, 소숫점 2째자리 N2
}
}
void MakeSquare()
{
Instantiate(square);
// public GameObject square; 로 변수 선언해주고
// instantiate 로 스퀘어 프리펩 가져옴.
}
public void GameOver()
{
//게임을 끝내고 endpanel을 켜야함
isPlay = false;
Time.timeScale = 0f; //타임 크기를 0으로 하면 멈춤. (기본은 1)
NowScore.text = time.ToString("N2");
EndPanel.SetActive(true);
//
}
public void Retry()
{
SceneManager.LoadScene("MainScene");
}
}
