Mina Pêcheux
Dec 20, 2022

--

Hi, and sorry for the late response! :/

So about the detection logic: the idea is that our guard checks for available targets around his position using Unity's physics system, and more precisely the OverlapSphere function. This function can take in an additional parameter to only look at colliders on a given layer, and here we tune it to specifically look at the "Enemy" layer.

So my guess is that perhaps:

- your enemy object contains some hierarchy of sorts, and you did not assign the layer "Enemy" to the part of this hierarchy with the collider

- or your layer "Enemy" is not the number 6 in your project, and so the `_enemyLayerMask` variable needs to be adjusted properly

If you want, you can also send me your code (at mina.pecheux@gmail.com) and I'll be glad to have a look to help you debug! ;)

--

--

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)

No responses yet