This seems kinda silly, but I don’t know the best way to go about using a raycast to detect an enemy. As far as I’ve been able to find online, one solution is (apparently) to make an ‘enemy’ data layer, and check if a raycast hits something on that layer. But I can’t understand how to make it work, even with tutorials, because none of the tutorials I’ve seen use data layers in this way. Am I just being stupid, or is there a better way to shoot enemies?
I’m assuming there’s a “right” way to do this, because it’s something literally every fps has to do, but for some reason it doesn’t seem to be that simple.