Load next level?

Hello. I am trying to make a little game called Roll A Ball. I have created a few separate scenes and am trying to figure out how to make the next scene load upon completion of the current scene. The scenes are named RollABall_1, RollABall_2, RollABall_3, etc. and all are included (in numerical order) in the Build Settings. I have created a script that loads level two once all objects have been gathered. The full C# script is

using UnityEngine;
using System.Collections;

public class LoadNextLevel : MonoBehaviour 
{

	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		{

		if ((GameObject.FindGameObjectsWithTag("Pickup")).Length == 0)

			Application.LoadLevel("RollABall_2");

		}
	}
}

The problem is that once level two is completed, that’s it. If I play test level three specifically, it loads level two, which is what it’s supposed to do. How can I change the script to make level one load to level two, level two to level three, etc.?

Replace the string name with something like this - Your levels will load in order in the build settings so keep that in mind:

int i = Application.loadedLevel;
Application.LoadLevel(i + 1);

This is probably the simplest way but you could also get the name as a string and replace the number with a higher one

I think what you’d want is to put this on a gameobject in level 1, use the DontDestroyOnLoad, store an integer in this and increment that using app loadlevel(someInt) instead of a hard coded string.