I have a script in which I want to compate if an object is in a certain LayerMask but I dont know why it does not work at all.
public LayerMask PlayersLayer; //this camp is set on the inspector
void OnCollisionEnter2D(Collision2D coll)
{
if (LayerMask.LayerToName(coll.gameObject.layer) == LayerMask.LayerToName(PlayersLayer.value))
{
Debug.Log("Explode");
ExplodeBlack();
}
}