AIPerceptionComponent C++


I have created an AIPerceptionComponent in C++ like so:

SetPerceptionComponent(*ObjectInitializer.CreateDefaultSubobject<UAIPerceptionComponent>(this, TEXT("Perception Component")));

I have chosen not to configure sense in C++ as there is an open issue on setting affiliations etc.

But now I have another problem, I cannot select the Sense Config!! The drop down with values shows up and no matter how many times or different values I select, it just shows NONE!!!

Has anyone else seen this, is it only in the preview version, has a fix to the original issue made it worse?

Wooah, this is insane. It does work!!!
After I removed the space between and compiled and created a new BP off it, and now I can select Ai Sight etc config and configure that…wicked…Thanks

Hi @Ambak , I believe that I saw this issue quite some time ago. I am digging pretty far back on this one so I hope this helps.

If I remember correctly, the problem might be that you have a space in the component name when you declare it in C++. Try declaring it without the space. Additionally, I remember that after I figured that out, I actually had to remake the blueprint (I can’t remember why this step was required) in order to get everything working as I expected. So try this as a test.

1.) Change your C++ to this

SetPerceptionComponent(*ObjectInitializer.CreateDefaultSubobject<UAIPerceptionComponent>(this, TEXT("PerceptionComponent")));

2.) Create a brand new blueprint from your class
3.) See if you can now change the sense config

@Ambak Awesome! Have fun! I changed my response to an answer in case others see the same behavior.

I’m sorry I can’t remember exactly why this was the case.

Man I love the AnswerHub… 2 years later, and that still helps someone :smiley: