Issues with collisions (OnTrigger)

OK i have been at this for hours now and I am not sure what else to try. I have made a top down 2D game, where the character runs into a box and it moves him to the next level. But there is never an actual collisions. When he gets to the box he just runs over it.

character and box has both rigid body and collider ( i added a rigidbody to the box later on because i read it could remedy the situation, it did not)

I have attached pictures of both settings on both sprites

This is the script i wrote for the box.

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

public class NewScene : MonoBehaviour {

[SerializeField] private string newLevel;

void OnTrigger2D(Collider2D other)
{
Debug.Log(“collision”);
if (other.CompareTag(“Player”))
{
SceneManager.LoadScene(newLevel);

}
}

}

I have tried dozens of options but none seem to work: including a different script, changing the order layers, updating unity, and using OnTriggerEnter2D (or whatever the correct syntax was) instead of OnTrigger2D, changing collision detection to continuous rather than discrete, changing the name of new level ( whether is is Scenes/scene2 or just scene2, and a few other options. I’m just not even sure what to try, and I am fairly certain it is going to be something small.



You need to set the box the player inters “is trigger” to “true” in order to receive trigger events (instead of CollisionEnter events)

you mean check the box to “is trigger” in the collider? I have that. I posted pictures with all the settings for both the box and character to see if that helps any.