unity how to check if an object's layer is in a layermask code example
Example: Check object is in layermask unity
public bool IsInLayerMask(GameObject obj, LayerMask layerMask)
{
return ((layerMask.value & (1 << obj.layer)) > 0);
}
public bool IsInLayerMask(GameObject obj, LayerMask layerMask)
{
return ((layerMask.value & (1 << obj.layer)) > 0);
}