Moving Between Areas/Levels

Hi,
I really need help. I try create moving between levels in my 2D game, but… it doesn’t work. I have unity version 2017, script is good, game works, in build settings I have my scenes, but… i don’t know what is wrong. Collider Box doesn’t moves player to second scene, I’m non-stop in first scene.

Could someone help?

First, add a Print or Debug.Log message in the collision check to make sure the collision is being detected.

And post your script using code tags – if it’s not working, I don’t think we can assume the script is good (it might be, but still).

A shot in the dark: make sure you used OnTriggerEnter2D() and not OnTriggerEnter2d().

So… that thing doesn’t work. I think maybe that version is wrong? In this video unity is version 5.0, so maybe that’s why it doesn’t work?
This is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LoadNewArea : MonoBehaviour {

    public string levelToLoad;

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

    void  OnTriggerEnter2D(Collider2D other) {
       
        if (other.gameObject.name == "Gracz")
        {
            Application.LoadLevel (levelToLoad);

        }
                }
}

Are you setting “levelToLoad” somewhere?

Yes, I have it in my game object with box collider 2D.

So, does anyone have an idea?

using System.Collections;
using UnityEngine;
using System.Collections.Generic;

public class loadnewarea : MonoBehaviour
{
public string levelToLoad;

// Use this initilization
void Start()
{

}

// Update is called once per frame
void Update()
{

}

void OnTriggerEnter2D(Collider2D other)
{

if (other.gameObject.name == “player”)
{
Application.LoadLevel(levelToLoad);
}
}

}