Hi,
The crash occurs once you call RequestStimuliListenerUpdate on UAIPerceptionComponent that doesn’t use all registered senses.
Reproduction steps:
- Create an Actor with UAIPerceptionComponent and assign Sight AND Hearing sense to it.
- Create another such Actor, but this time assign only one sense Sight or Hearing.
- At random time in game call RequestStimuliListenerUpdate on the second actor.
- Viola, the game crashes.
The problem is with the following code that exists in both senses in function OnListenerUpdateImpl(const FPerceptionListener& UpdatedListener)
const FPerceptionListenerID ListenerID = UpdatedListener.GetListenerID();
if (UpdatedListener.HasSense(GetSenseID()))
{
const UAISenseConfig_Hearing* SenseConfig = Cast<const UAISenseConfig_Hearing>(UpdatedListener.Listener->GetSenseConfig(GetSenseID()));
check(SenseConfig);
FDigestedHearingProperties& PropertiesDigest = DigestedProperties.FindOrAdd(ListenerID);
PropertiesDigest = FDigestedHearingProperties(*SenseConfig);
}
else
{
DigestedProperties.FindAndRemoveChecked(ListenerID);
}
As you can see once the UpdatedListener.HasSense(GetSenseID()) fails it forces a checked removal (FindAndRemoveChecked) of a ListenerID that actually never existed for this sense, what eventually asserts on check(PairId.IsValidId());
I hope I helped with identifying the problem and that it’s gonna be fixed soon. Thank’s in advance.
Cheers,