using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Possible: MonoBehaviour
{
ย ย public string select;
ย ย public bool Gragas = true;
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gragas : MonoBehaviour
{
ย ย private Possible a;
ย ย void Awake()
ย ย {
ย ย ย ย a = GetComponent<Possible>();
ย ย }
ย ย public void change()
ย ย {
ย ย ย ย a.select = "Gragas";ย
ย ย }
}
๋กค ๋ฐดํฝ๊ตฌํ์ค์ธ๋ฐ change ํจ์์ ์๋ย select ๋ถ๋ฌ์ค๋ ์ ๊ธฐ์ ์๊พธ ์ค๋ฅ๋ธ
NullReferenceException: Object reference not set to an instance of an object
๋ ๋ฌด์จ ๋นก๋๊ฐ๋ฆฌ์ง ํ๊ธธ๋ ย ๋ชป๋ถ๋ฌ ์ค๊ณ ์๋๊ฑฐ๋? ์๋ ๋ฅ๋ ฅ์ ์์ผ๋ฉด ์ ๋ฐ ์๊ทธ๋ฐ์ง ์๋ ค์ค ใ ใ ใ
ํ์๋ธ์ด๋ผ๋ ์ปดํฌ๋ํธ ์ถ๊ฐ๋ ํ๊ณ ์ด๊ฑฐ๋?
์ ์น ๊ณ ๋ง๋ค;
ํด๋น ๋๊ธ์ ์ญ์ ๋์์ต๋๋ค.
ใ ใ ใ ใ ใ ใ ใ ๊ณ ๋ง๋ค ํด๊ฒฐํ๋ค
gragas ์ปดํฌ๋ํธ ๋ถ์ ๊ฒ์ ์ค๋ธํธ์ Possible ์๋ถ์ด์์
ใณใณ ํด๊ฒฐํจ
ใ ใด์๊ธฐ๋ค ใ ใ