I understand why and how we wrote a new method to use in the case of the end scene linking to the start scene, but when I connected scenes, I wrote it all in one method using an “if…else” statement where the method would change to scene one if it was on the final scene, else it would simply move onto the next scene in the load order.
Can someone tell me when it would be appropriate to write it all in one method like I did and when it would be appropriate to simply write a new method like we did during the lesson?
I want to make sure my coding habits are spot on.
Thanks!
For reference, here is the method I used.
public void LoadScene()
{
int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
if(currentSceneIndex = 2)
{
SceneManager.LoadScene(0);
}
else
{
SceneManager.LoadScene(currentSceneIndex + 1);
}
}