Level Loading help

l need help with level loading l have a code that you can say it works 50% cuz when l go to the finish it dosen’t take me to the level l made it to it just loads the same one.Can some one help me

here is the code:

using UnityEngine;
using System.Collections;

public class NextLvl : MonoBehaviour {

	public GameObject Player = GameObject.FindGameObjectWithTag("Player");

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	void OnTriggerenter2D(Collider2D col){
		if (col.gameObject.tag == "Finish") {
			Application.LoadLevel (1);
		} 
}
}

In the build settings, which you can find under file (top left corner) you have to add the scene to the build.
If you click add Current it will only add the current scene that you have opened.

To go to the next level use

//Change nameofScene to the name of the scene you want to add.
    Application.LoadLevel("nameofScene");

Or change it by a number like you did, the number stands for the order you added the scenes in the build settings. If you are in scene 1 and you want to go to the next scene which you have set in the build setting as scene 2, you use :

 Application.LoadLevel(2);

51634-2.png

If you want it to always load the next level just type:

Application.LoadLevel(loadedLevel + 1);

So if you are in level 0:

loadedLevel = 0

And the next level is 1

This happens to me when i do not load every one of my scenes in the build option, I have had plenty of experience with it, Double check to make sure all of the scenes are in the correct order starting from 0 under the build settings menu.

Feel free to like this answer if it helps you, If not then i will get back to you at the earliest convenience.