Unity refuses to properly mask raycasts for any user layer other than 8. I use this code
int layerMask = 1<<8;
int layerMask2 = 1<<9;
When I test both, the first one works fine against layer 8 objects, the second collides with none. Why?
Unity refuses to properly mask raycasts for any user layer other than 8. I use this code
int layerMask = 1<<8;
int layerMask2 = 1<<9;
When I test both, the first one works fine against layer 8 objects, the second collides with none. Why?
Sorry, but this question is pointless in it’s current form. I can assure you that the Raycast is working as intended. If it doesn’t work for you, you might have something wrong. Either your raycasting code or your scene setup. Since you didn’t provide any of that information in your question there’s nothing we can do for you here.
Just a quick checklist: