Collision Problem/Question

I’ve been wondering if there is any way to make it so that an object passes through other object but can still detect collisions. If I use:

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

public class CollideEnd : MonoBehaviour {

void OnCollisionEnter(Collision col) {
	if(col.gameObject.name == "Player") {
		Debug.Log("you died");
	}
}

}

it doesn’t work without a rigidbody/box collisions but with a box collision it collides with everything, any help? If you need more information just ask

Hi, you can try setting your collider as a trigger then use something like this:

void OnTriggerEnter(Collider col) {
          if(col.gameObject.name == "Player") {
         Debug.Log("you died");
}

Be sure that the moving object has a rigidbody on it, and the colliding object has the bool active on IsTrigger value in the collider component. And obviously check that they are “physically” colliding.