How do I make a collision with an object progress to the next scene?

How do I make a collision with an object progress to the next scene? I have looked at many tutorials and none have worked or benifited. I and trying to make a simple platformer and when you touch a square (a place holder) that is at the end of the level. Here is my code so far,and I don’t know if I’m even close.

void OnTriggerEnter2D(Collider2D Colider)
{
if (Colider.gameObject.tag == “Player”)
Application.LoadLevel(1);
}

There’s a couple things I would try here.

  1. Utilize Debug.Log()

I would make sure that you’re collision is actually happening. Modify your code to this:

void OnTriggerEnter2D(Collider2D col)
{
     if(col.gameObject.tag == "Player")
     {
          Debug.Log("Collision occurred!");
     }
}

This should check to ensure that your collision is actually happening. If you test your scene again and it continues to not trigger, check the tag on your player object and make sure that the cube’s collider has “is Trigger” set to true. Otherwise this collision will not work.

  1. Check your build settings

Often times an error occurs because you have not placed your scene in the build order or that you’ve used the wrong number. Check this by hitting Ctrl-Shift-B (Windows) or Command-Shift-B (Mac). Make sure that the scene you want to go to has been inserted in. If not, drag and drop the scene from your project into this window and then arrange it underneath your main scene.

  1. Use the new “SceneManagement” class

This is probably one of my least favorite new features in Unity because it goes against everything I’ve been learning for the past 3 years. In a recent update, a new class was created to handle the transitioning between scenes a.k.a “SceneManager”. It works the exact same way as the old “Application.LoadLevel” except it’s not automatically imported into your script. To translate your script into this new class, change your code to this:

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement

public class MyCoolSceneScript : Monobehaviour //you dont have to change this part
{
     SceneManager sceneManage;

     void OnTriggerEnter2D (Collider2D col)
     {
          if(col.gameObject.tag == "Player")
          {
               sceneManage.LoadScene(1);
          }
     }
}

That’s all the help I can give based off of your limited question. If any of this doesn’t work, comment and me or another member here on Unity Answers will try to help you ASAP