How can I check the object for several layers? The example below does not work! I want to have one variable where all the layers with which I want to compare the object can be written. This is more convenient than the NameToLayer
LayerMask layersContact;
void Start()
{
layersContact= LayerMask.GetMask("Road", "Terrain");
}
void Update()
{
if (gameObject.layer == layersContact)
{
Debug.Log("WORK!!!");
}
}