So, I’m new in the “codding world” and I want to do a simple game but I have a problem. I made a finish point and a scene manager, it changes the scene but my player it’s not appearing. Because I’m new, I don’t know what other details would be important, so I’ll leave the codes:
Finish point
using UnityEngine;
public class FinishPoint : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("Player"))
{
// go to next level
SceneController.instance.Nextlevel();
}
}
}
Scene manager
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneController : MonoBehaviour
{
public static SceneController instance;
private void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
public void Nextlevel()
{
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1);
}
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}