In my code I have a layer mask defined
public LayerMask death_layer;
but when I do this it doesn’t work
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.gameObject.layer == death_layer)
{
Debug.Log("aaa");
}
}
but if I change it to the int of the layer 6 it works
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.gameObject.layer == 6)
{
Debug.Log("aaa");
}
}
I know i could keep it as 6 but I just want an answer about how this issue is happening.