강의

멘토링

커뮤니티

Inflearn Community Q&A

tiky9662's profile image
tiky9662

asked

Just follow along! Creating a TPS game.

Shooting Settings

27:46 4강) 콘솔 에러가 발생했습니다

Resolved

Written on

·

320

2

 

NullReferenceException: Object reference not set to an instance of an object

GameManager.Update () (at Assets/_My/Scripts/GameManager.cs:50)

 

콘솔에 출력된 에러 내용입니다.

cs:50 은

bulletText.text = currentBullet + " / " + maxBullet;

부분입니다.

 

오브젝트를 못찾는거같은데 어떻게 해결할 수 있을까요

 

 

C#unity

Answer 1

1

doublelsoft2276님의 프로필 이미지
doublelsoft2276
Instructor

영상 26:47에서
using UnityEngine.UI;
선언을 해주고

[SerializeField]

private Text bulletText;

작성하셨다면

유니티로 돌아와서 Hierarchy창에 GameManager 오브젝트를 선택합니다.

Inspector창에 GameManager 스크립트를 보게되면

BulletText가 있는데 여기에 Canvas에서 생성한 Text를 드래그해서 추가합니다.

영상 28:03에서 Inspector창을 보게되면 BulletText란에 Text를 추가해준 부분을 보실 수 있으실것입니다.

본 영상에서 추가하는 부분이 빠져있던점 죄송합니다.

 

tiky9662's profile image
tiky9662

asked

Ask a question