커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
게임 매니저 인수 지정 오류
undefined주차
북마크
원*재
댓글
1
추천
0
조회수
10
조회수
10
답변 완료

빗물 받는 르탄이 게임 만들기에서 게임 매니저를 통해 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);
    }
}


취소
 공유
취소
댓글 0
댓글 알림
나의얼굴