PerceptionComponent SensesConfig fails to save

Using latest promoted I’ve reworking my code to use the new perception API and it appears the SensesConfig array in the perceptioncomponent does not serialize correctly. The instanced array when compiled always resets its entries to none. I’m forced to manually construct the config objects at runtime and call ConfigureSense.

I also had to adjust ConfigureSense to take a pointer so I can pass the derived types and call UpdatePerceptionFilter to actually allow the AIController with the perceptioncomponent to have the correct PerceptionFilter. The last sentence may be expected behavior.

UPDATE: This issue is a engine wide bug/lack of feature for a TArray of editinlinenew ubobjects with the Instanced modifier. The objects reference in the array is lost when their owner is a native subobject. This current bug can be worked around by having a dynamic and non-native AIPerceptioncomponent added to the aicontroller.

Similar bug/post here: Blueprint will not hold reference - Blueprint - Epic Developer Community Forums

How, or maybe more important, when are you filling your SensesConfig? I might need another look, but maybe you should try setting it up in PostLoad or PostInitProperties? Just give it a go and let me know how it went. If it still fails I’ll take care of it today.

Thanks for using new stuff! :smiley:

–mieszko

First I tried creating the SensesConfig instances in the instanced array property within the component on blueprint template archetype. Compiling that blueprint always forced the array entries to none.I have other code that uses editinline and instanced fine so I’m not sure of why this occurs.

To get something working I did the following:
Within a specific AIController I configured the two senses in PostInitializeComponents. While this did force a StimuliListenerUpdate it did not register all the sense classes for each sense config.
So for now in a hacky way in Possess I’m first calling UpdatePerceptionFilter with the sense_sight , then registering the Sense_hearing and then UpdatingPerceptionFilter with sense_hearing.

If the sense_hearing class is registered before I do the first call to UpdatePerceptionFilter OnListenerUpdateImpl is called via the PerceptionSystem on the AISense_Hearing. The provided AIController/Listener doesn’t have the filter channel set for the Hearing so the HasSense if fails and then the DigestedProperties.FindAndRemoveChecked(ListenerID); will error out.

Thanks a lot for reporting it. I’ll look into it.

Another related issue is the MaxActiveAge array on the PerceptionComponent is empty when the sense configs aren’t created on construction. I wasn’t sure if I should write a new post for that or just piggy back on this one. I’d submit a pull request, but I don’t understand the purpose of that array.

HasAnyActiveStimulus and GetYoungestStimulusAge will fail if that array is empty.

Any Updates?

I figured out a workaround and saw the same bug happen in a different component. See my main entry update for more information.

Hi ,

Would you be able to provide more details about the workaround that you are using? The issue mentioned in the link you provided appears to be fixed internally, and will be corrected in a future release version. If you can provide more information about your workaround, we can investigate whether the existing fix will help with your issue as well, or if we need to expand it.

More details/repro steps found here. My initial code side workaround isn’t worth doing for the general case. The easy workaround is to just create the component at editor time or post construction.