
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
저번에도 여기서 걸려서 강의 처음부터 들으며 찬찬히 진행했는데
또 여기서 오류가 나네요 ㅜㅜ
나머지는 다 동작이 잘 되는데
[다시하기] 버튼을 눌렀을 때 아래 첨부한 사진과 같은 오류 메세지가 뜹니다.
(오류 메세지는 캡쳐하여 하단에 첨부하겠습니다.)
처음엔 혹시 mainScene 파일명이
public void retry()
{
SceneManager.LoadScene("mainScene");
}
코드 내 동일하지 않아서 인가 싶어서 동일하게 변경도 해보았습니다.


작성한 코드 및 에러 메세지
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
public GameObject square;
public Text timeTxt;
public GameObject endPanel;
public Text thisScoreTxt;
float alive = 0f;
bool isRunning = true;
public static GameManager I;
void Awake()
{
I = this;
}
// Start is called before the first frame update
void Start()
{
Time.timeScale = 1.0f;
InvokeRepeating("makeSquare", 0.0f, 0.5f);
}
// Update is called once per frame
void Update()
{
if (isRunning)
{
alive += Time.deltaTime;
timeTxt.text = alive.ToString("N2");
}
}
void makeSquare()
{
Instantiate(square);
}
public void gameOver()
{
isRunning = false;
Time.timeScale = 0.0f;
endPanel.SetActive(true);
thisScoreTxt.text = alive.ToString("N2");
}
public void retry()
{
SceneManager.LoadScene("mainScene");
}
}
Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
