using System.Collections;
using System.Collections.Generic;
using System.Data.Common;
using UnityEngine;
using UnityEngine.SceneManagement;

public class WorldSaveManager : MonoBehaviour
{
ย  ย  public static WorldSaveManager instance;
ย  ย  [SerializeField] int worldSceneIndex = 1;
ย  ย  private void Awake()
ย  ย  {
ย  ย  ย  ย  if(instance == null)
ย  ย  ย  ย  {
ย  ย  ย  ย  ย  ย  instance = this;
ย  ย  ย  ย  }
ย  ย  ย  ย  else
ย  ย  ย  ย  {
ย  ย  ย  ย  ย  ย  Destroy(gameObject);
ย  ย  ย  ย  }
ย  ย  }
ย  ย  private void Start()
ย  ย  {
ย  ย  ย  ย  DontDestroyOnLoad(gameObject);
ย  ย  }
ย  ย  public IEnumerator LoadNewGame()
ย  ย  {
ย  ย  ย  ย  AsyncOperation LoadOperation = SceneManager.LoadSceneAsync(worldSceneIndex);
ย  ย  ย  ย  yield return null;
ย  ย  }
ย  ย 
}


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TitleScreenManager : MonoBehaviour
{
ย  ย  public void StartNewGame()
ย  ย  {
ย  ย  ย  ย  StartCoroutine(WorldSaveManager.instance.LoadNewGame());
ย  ย  }
ย  ย 
}


์”น๋‰ด๋น„๋ผย ์ตœ์ ํ™” ๊ฐ™์€๊ฑฐ ์ž˜ ๋ชฐ๋ผ์„œ ๋ณด๊ณ  ์•”๊ฑธ๋ ค๋„ ์ดํ•ด ์ข€ ๋ถ€ํƒํ•จ

๋ฐฐ์šด๊ฑฐ๋กœ ์—ด์”ธํžˆ ํƒ€์ดํ‹€ ์”ฌ ๋ณ€๊ฒฝํ•ด๋ณด๊ณ  ์žˆ๋Š”๋ฐย 


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

TitleScreenManager.StartNewGame () (at Assets/TitleScreenManager.cs:9)


<<<์–˜๊ฐ€ ์ž๊พธ ๋œจ๋ฉด์„œ ์”ฌ์ด ์•ˆ๋ถˆ๋Ÿฌ์™€์ง


๋‚ด ์Šคํฌ๋ฆฝํŠธ์— ๋ณ€์ˆ˜๊ฐ€ ์„ ์–ธ ์•ˆ๋๊ฑฐ๋‚˜ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์•ˆ๋ถˆ๋Ÿฌ์™”๊ฑฐ๋‚˜ ๊ทธ๋Ÿฐ ๊ฑฐ ๋•Œ๋ฌธ์ด๋ผ๋Š”๊ฑด ๊ตฌ๊ธ€๋งํ•ด์„œ ์•Œ์•„๋ƒˆ๋Š”๋ฐ ์ž˜ ๋ชป์ฐพ๊ฒ ์Œ...

๋„์™€๋‹ค์˜ค