When I add the AIPerceptionSystemComponent in the BluePrint editor, and add a sense to the SensesConfig, the DetectionByAffiliation is correctly displayed : it is expanded, and I can check the 3 checkboxes.
But when I create the perception system in C++, the DetectionByAffiliation is not expandable, and I can’t change the value. More importantly, even changing the values in code doesn’t seem to be reflected at runtime. When I use the blueprint version, and log some text in the event called when the perception is updated, I have some logs.
Using the same settings in the C++ version, nothing is displayed, because the affiliation check fails in FAISenseAffiliationFilter::ShouldSenseTeam in the Update function of UAISense_Hearing for example.
I have investigated this issue and discovered that it is a known issue (UE-18378). Thank you for your report. I will update the bug report with this post.
I added the component in the blueprint directly, and in code I call GetPerceptionComponent() instead of using directly the pointer. That is the only workaround I found
Sorry about bump this thread up. I found this issue had been add a fix commit and last updated was at Jan 25, 2018. Is that means the issue had been solved? If yes, will the commit be merged into 4.19?
At this time the ticket is still unresolved. Those fix commits are from a previous version of the fix that ended up needing to be re-evaluated. Once a new fix version is available, it will appear on the public ticket.
I was surprised to discover how long this has been a bug. I did find a decent workaround you can do get it populated in the editor. First, temporarily add another AIPerceptionComponent to your Controller Blueprint. The editor added one will have Detection as Affiliation populated, you can set it however you like. Once you’ve done that, if you right click and pick copy, you can then go to the inherited one and right click on ‘Detection as Affliation’ and pick paste. It will copy those values into it. The underlying struct is still there, just the Editor UI is busted. After you paste it over, you can just delete the one you added. You could even keep it pasted in a text file and keep it that way if you don’t like adding fake components constantly. If you want to inspect what is already set, you can copy it and paste it into a text file to check the values.