Make object raycast detect just one specific object

I have a situation where I have multiple Agent objects running around in a warehouse.
Each forklift (agent) has its own target (which is a GameObject with a target tag).

My forklifts (agents) have raycast attached to them to explore the environment.

How can I make sure that agent A only detects target A, agent B only detects target B etc with their raycasts?

I need to do this because when I insert 2 agents and 2 targets with each a target tag agent B will go to agent A's target and vice versa, I want to avoid this.

Thanks in advance!

I believe to do this using Ray Perception Sensors every target would need to have a unique tag. Of course you also have the option of writing code to do your own raycasts, in which case you have more flexibility, and could for example check for a specific object being hit.

1 Like