Help Please UAIPerception Component incomplete class

Hey all,

I’m very new to programming in C++ and doing so in the engine, while I was following a tutorial online I came across a problem which I cannot seem to figure out myself (by the lords I have tried)

The issue as far as I can tell is that VS/Unreal seems to think that UAIPerceptionComponent has no declaration or least, not a valid one. I have followed it back to find the headers to include and I believe I have done so. Initially, I was trying to do SetPerceptionComponent(CreateDefaultSubobject<UAIPerceptionComponent>(TEXT(“Perception Component”))); My understanding is that it would create a new perception component and apply that to be the used one by the AI controller. I then tried what you will find at the bottom of the code. GetPerceptionComponent()->SetDomiantSense(*SightConfig->GetSenseImplementation()); This gives no errors until I try to access something from that GetPerceptionComponent() My code is attached along with the error message. I would really appreciate some help!

I think you were right looking into the headers and adding

#include "Perception/AIPerceptionComponent.h"

should solve this.

Hey Silik1, Firstly hope you are staying safe where you are! Secondly thank you for that I did add it and it seemed to sort that issue but in doing so created another of which I’m stumped again!

I added that include but then my project refused to compile, I deleted .vs, Binaires, intermediate and saved folders and generated the files again. Still no avail so I compiled it within VS and it does work if I comment out any actual use of the perception component, but the include itself has no issue being there. this is the error once I’m building from VS (is attached as file :)) Any help one again I would be very grateful! :smiley:

Something went wrong when you created the component cause it’s nullptr…

Please scrap that, I found out its due to me not actually creating a perception component so when trying to access it I believe it was coming back all null. I thought AI perception would already have the component but I guess it doesn’t. Thank you very much for your assistance! All keep safe

Just noticed your reply as I posted haha thank you again and have a great day!