So i have code in my project that states when the end of the stage is reached, it takes the build list number, adds one, and takes you to that scene. but for some reason, no matter what i try, upon completing the first stage, it goes to the third stage. after that the code works fine, its just the start and i cant find any reason why
this is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class WinZone : MonoBehaviour {
public void OnTriggerEnter2D (Collider2D other)
{
SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex + 1);
}
}
i've asked some people i know and they have no idea why this issue exists, given the fact it works fine after the first transfer of scenes. if anyone can help it'd be great.
this is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class WinZone : MonoBehaviour {
public void OnTriggerEnter2D (Collider2D other)
{
SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex + 1);
}
}
i've asked some people i know and they have no idea why this issue exists, given the fact it works fine after the first transfer of scenes. if anyone can help it'd be great.
Last edited: