I'm using CanSeeObject targetting character layer in order to check if character can be seen. It works despite the fact that the returned object isn't the character gameobject but its capsule collider... Any ideas?
A little more info.
I have this tree, with 2 branches, the one on the left runs when there's no TargetEnemy (TargetEnemy is null) and, if it comes within sight, store it into TargetEnemy shared variable. The branch on the right runs when TargetEnemy != null and check if TargetEnemy is still within sight. If not, reset TargetEnemy to null. The CanSeeObject of the left branch is setted to look for the character on the Character + Enemy layers. The CanSeeObject of the right branch is setted to look for TargetEnemy as its TargetObject.
If I force TargetEnemy to Character value (Nolan) everything works fine (the right branch), but since the CanSeeObject of the left branch set it to Nolan's capsule collider, the CanSeeObject of the right branch fail to see the TargetEnemy (capsule collider) as soon as it is setted, then the left branch see and set it again, the right branch unsee and reset it and so on..
If I set the CanSeeObject on the left to look for the character using its tag, everything works fine... I mean, the CanSeeObject return Nolan gameobject, not its capsule collider
In the sample scene the agent will target the character's head because Can See Object has Use Humanoid Bone selected. If you don't want to do something similar you can create a task which returns the parent object so it targets the character's base GameObject.