Identifying Detection Issues - Black-Horizon-Studios/Emerald-AI GitHub Wiki
These are the most common kinds of target detection issues. Please refer to the list below to figure out which issue you are having.
AI is not detecting targets even if I enter their detection radius.
If your AI are not detecting targets when they enter their detection radius, this most likely has to do with incorrect layers or tags setup. Layers and Tags are explained in-depth in this section of the Emerald AI Wiki.
Note: The Player Tag is set in a different tab than where an AI tags are setup. This is done through the AI's Player Relation which is located under Detection & Tags>Tag & Faction Options>Faction Options.
AI is reacting to a player target when they enter their detection radius, but they don't attack
If your AI are not detecting player targets correctly, first check this section of the Emerald AI Wiki to ensure you have setup your player's tags and detectable layers correctly. If you have, you can continue with with troubleshooting guide.
Step 1
The most common cause of detection problems with player targets is when there's a hidden collider within the player. Because users often use 3rd Party solutions for character controllers, this isn't always known.
To identify if there's a hidden collider within your player, first you will need to enable the Debugging Tools which are located under the Docs tab underneath the Report a Bug button within your AI's Emerald AI Editor. Next, you will also need to enable Debug Log Targets and Debug Log Obstructions. This will allow Emerald AI to debug log the detected target or obstruction to the Unity Console.
The Debugging Tools are explained more in-depth in the Debugging Tools section. It is recommended that users familiarize themselves with the debugging tools as this can usually help identify the detection issues.
Step 2
If there is a collider within your player target that's blocking the AI's line of sight, or some other type of collider, you should see it displayed in the Unity Console. This should help you identify what is blocking your AI's line of sight to the player target.
Once you have identified the target, you can add its layer to the AI's Obstruction Ignore Layers. This will allow the obstructing object's layer to be ignored by the AI's line of sight so it will no longer block the AI's vision. This can also be useful for any other objects you want to be ignored by an AI's line of sight.