[Bug] AIPerceptionComponent won't set AIOwner if placed on AI Controlled pawn

Hey there

I was on a wild goose chase to find out why AiHearingSense wouldn’t work with GenericTeamIds while AiSightSense could. Turns out they do not fetch their info from the same place and Hearing will take it’s data from FPerceptionListener which in turns takes it from the AiPerceptionComponent which will take it from it’s AIOwner.

Problem is, it will not try to see if it is attached to a pawn or a controller. I assume this is a bug since it was stated that AIPerceptionComponents could be placed on either a pawn or a controller. See
UAIPerceptionComponent::OnRegister()

Rag tag solutions:

  • Put the component on AIControllers and not pawn
  • Extend AIPerceptionComponent and listen to Possess if on a pawn and add the controller as AIOwner

Cheers