How does CanSeeObject work?

EVG

Member
Why can an object with CanSeeObject find an adversary even through walls? should it be so?
 
Here are a couple of threads which should help:

 
It seems like I solved the problem by removing some of the code from MovementUtility, but I do not think that this is normal and correct. I hope in a future update this will be fixed out of the box.
 
I ran into this exact same issue. The problem was caused by the following lines in MovementUtility:


else if (GetComponentForType<Collider>(targetObject) == null && GetComponentForType<Collider2D>(targetObject) == null) {
// If the linecast doesn't hit anything then that the target object doesn't have a collider and there is nothing in the way
if (targetObject.gameObject.activeSelf)
return targetObject;
}

The problem is I DO NOT PUT MY COLLIDERS IN THE PARENT OBJECT OF THE TARGET.

Its pretty amazing this line of code is still in there, as I spent over an hours debugging this.
 
Top