Is it possible for an AI to ignore some targets and only attack others?

poiler22

New member
I found that on the DEMO scene when I duplicated the Agentnolan, they would not attack each other, but when I created another AI by myself it got attacked somehow. If anyone can give me some help, I would be appreciated.
 

Justin

Administrator
Staff member
If you're using the Can See Object task then the agent is likely seeing the same layer mask. In this situation you should assign a set of GameObjects using the variable system that the Can See Object task can see:

 

poiler22

New member
If you're using the Can See Object task then the agent is likely seeing the same layer mask. In this situation you should assign a set of GameObjects using the variable system that the Can See Object task can see:

Thank you for your reply; however, I don't quite understand what you said. Can you please clarify more? Do I have to do modify a script? If so which one. Sorry for my ignorance.


Edit: I figured out that this has something to do with the inspector's variable in behavior designer right?
 

Justin

Administrator
Staff member
This page is related to referencing scene objects, but it should help with your use case as well:


On the Target Objects field of the Can See Object you'll need to assign that SharedVariable. You can either do it in the editor, or at runtime by setting the variable through script.
 
Top