I’m trying to set up a per-unit sensor in order to detect when friendly units get near for the unit to follow. However, at the moment I’m using an OverLapSphere. It’s completely ignoring my “Obj.tag” and detecting everything, and not making any sense as to why it should for me.
targetArray = Physics.OverlapSphere(transform.position, 1.5f, mask.value);
foreach(Collider obj in targetArray)
{
if (obj.tag == "ConvoyMember" || obj.tag == "Player")
{
followTarget = obj.gameObject;
CancelInvoke("changeDirection");
transform.parent = null;
behaviourMode = behaviour.follow;
break;
}
}
One possibility is that the object sending out the OverlapSphere is also a “ConvoyMember”, but it shouldn’t be detecting itself. Is there any way to stop that from occuring?