- Home /
Using a Public LayerMask within OnTrigger
Need help with the following code, if statement is always false.
Public LayerMask attackableLayer;
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log(other.gameObject.layer == attackableLayer.value);
Debug.Log(other.gameObject.layer == attackableLayer);
if (other.gameObject.layer == attackableLayer.value)
{
/*
Add target to list
If user CPU enable AutoAttack()
else wait for ManualAttack()
*/
Debug.Log(other);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612072212im_/https://answers.unity.com/themes/thub/images/avi.jpg)