unity find object by layermask code example
Example 1: Check object is in layermask unity
public bool IsInLayerMask(GameObject obj, LayerMask layerMask)
{
return ((layerMask.value & (1 << obj.layer)) > 0);
}
Example 2: unity get layermask
int layer = (int)Mathf.Log(uninteractablePartsLayer.value, 2);
Debug.Log("uninteractablePartsLayer "+LayerMask.LayerToName(layer));