I can’t get the raycast to recognise walkable areas (I’ve triple checked my layer settings) . It always returns the enemy layer. The only way I can get it to return the walkable layer is if I change the layerMask variable in RaycastForLayer to 2 instead of 1.
Can anyone help me? I literally can’t continue with the course unless this issue is resolved. I’ve tried the discord and haven’t had a response.
Could you pop up a screenshot of the layer priorities array from the Inspector for the CameraRaycaster script component (I think that was the component from memory that had this).
Also, perhaps copy/paste up your scripts so we can have a look?
From memory, weren’t there layers in the layer priorities around the other way, e.g. enemy first, then walkable after? I could be wrong, give it a try.
Could you zip up your project files and share them so I can take a look? Where you are in the course doesn’t map up with where I was when I last looked at it, so I can’t really just compare.
Also, be aware that you change a fair bit of this functionality later on, so I wouldn’t worry too much if it isn’t quite right just yet. That being said, happy to take a look and see if there’s anything I can spot.
The forum will allow uploads of up to 10mb, I suspect your zipped project files will be larger than that so you’ll need to use a service such as Google Drive or Dropbox and then share the URL.
I’ve just compared your CameraRaycaster.cs script to the one linked from the lecture to Project Changes, the only two differences are the order of the items in the LayerPriorities array at the top of the script, and the inclusion of the enum, which isn’t present in the course version. Presumably this is in Utility.cs instead (I think that’s what it was called)
Incidentally, I think this is the lecture where you’ll find that you don’t get the Unknown cursor appear, this is corrected in the following lecture I believe when Ben spots it isn’t working