
빗물 받는 르탄이 게임 만들기에서 게임 매니저를 통해 Instantiate 함수로 빗방울을 생성하는 것은 성공적으로 작동되는데, 오류창이 떠서 질문드립니다.
발생한 오류는 다음과 같습니다.
UnassignedReferenceException: The variable rain of GameManager has not been assigned.
You probably need to assign the rain variable of the GameManager script in the inspector.
UnityEngine.Object.Instantiate[T] (T original) (at <e8a406da998549af9a2680936c7da25a>:0)
GameManager.makeRain () (at Assets/Script/GameManager.cs:22)
게임매니저 오브젝트의 rain 변수에 rain 프리팹 드래그는 이미 완료했습니다.


작성한 코드 및 에러 메세지
전체 코드는 다음과 같습니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
public GameObject rain;
// Start is called before the first frame update
void Start()
{
InvokeRepeating("makeRain", 0, 0.5f);
}
// Update is called once per frame
void Update()
{
}
void makeRain()
{
Instantiate(rain);
}
}
