
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
패널 누르면 재시작 해야하는데 패널 자체가 안눌립니다.
시간이 다 되면 패널 팝업은 되고,
버튼까지 설정하고
이제 패널 스크립트 작성해서
버튼의 온클릭에 집어넣었는데
"강사님은 no function 에서 panel.retry으로 변경하셨는데"
"저는 no function에서 panel.retry가 안됩니다."

작성한 코드 및 에러 메세지
############gameManager.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
public GameObject rain;
public GameObject Panel;
public static GameManager I;
public Text scoreText;
public Text timeText;
int totalScore = 0;
float limit = 5f;
void Awake()
{
I = this;
}
// Start is called before the first frame update
void Start()
{
InvokeRepeating("makeRain", 0, 0.5f);
}
void makeRain()
{
Instantiate(rain);
}
// Update is called once per frame
void Update()
{
limit -= Time.deltaTime;
if (limit < 0)
{
limit = 0.0f;
Panel.SetActive(true);
Time.timeScale = 0.0f;
}
timeText.text = limit.ToString("N2");
}
public void addScore (int score)
{
totalScore += score;
scoreText.text = totalScore.ToString();
}
public void retry()
{
SceneManager.LoadScene("MainScene");
}
}
##########panel.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class panel : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void retry()
{
GameManager.I.retry();
}
}
Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
