How can I use Can See Task for detect multiple enemies?

Kehaw

New member
Hello, every one.

I hope my NPC select a random target for attack(Player or hostile NPCs), when its detect multiple target in same time with Can See Task.

The player and hostile NPCs are not on same layer mask and has different tags.

Should I use two or more Can See Tasks?

My inspector looks like this but it doesn't work for my idea.

1703236359748.png
 
The easiest approach would be to specify an object list for the detection mode and then specify each GameObject.
 
The easiest approach would be to specify an object list for the detection mode and then specify each GameObject.
But you know, some times the hostile NPCs maybe generate by script...

e.g: There has 3 kinds of game characters in same scene: Blue force, Red force and player, they are attacking each others.
 
In that situation you can either use a SharedVariable and set a new value for when you spawn the enemy. You could also subclass the Can See Object and respond to an event when the enemy spawned.
 
Top