Выдаёт ошибку "NullReferenceException: Object reference not set to an instance of an object sceneMan.OnTriggerEnter2D (UnityEngine.Collider2D collision) (at Assets/sceneMan.cs:14)" когда я пытаюсь найти empty object с тегом или с названием.
Вот скрипт:
using UnityEngine;
using UnityEngine.SceneManagement;
public class sceneMan : MonoBehaviour
{
public bool nStory;
public int id;
private void OnTriggerEnter2D(Collider2D collision)
{
SceneManager.LoadScene(int.Parse(name));
if (nStory)
{
Debug.Log("ppos"+id);
Debug.Log(GameObject.Find("Player").name);
Debug.Log(GameObject.FindGameObjectWithTag("ppos").name);
GameObject.Find("Player").transform.localPosition = GameObject.Find("ppos" + id).transform.localPosition;
}
}
}