# Extending UAIPerceptionSystem

**URL:** <https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [August 28, 2015, 11:56pm UTC](https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058 "2015-08-28T23:56:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_89f0aa1e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_89f0aa1e](https://forums.unrealengine.com/u/anonymous_user_89f0aa1e)\
**Post date:** [August 28, 2015, 11:56pm UTC](https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058/1 "2015-08-28T23:56:34Z")

</div>

Hey there,  
I’m trying to extend the AI Perception System to use some new actors to be noticed by the system (UAISystem::OnActorSpawned notifies only about Pawns so far).

I’m simply extending the UAIPerceptionSystem:

Header:

```auto

#pragma once

#include "Perception/AIPerceptionSystem.h"
#include "MyAIPerceptionSystem.generated.h"

UCLASS()
class UMyAIPerceptionSystem : public UAIPerceptionSystem
{
    GENERATED_BODY()
};

```

I get errors in the AIPerceptionSystem.h when compiling:

```auto

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:102:30: error: incomplete type 'UAISense' named in nested name specifier

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:102:84: error: expected '(' for function-style cast or type construction

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:102:86: error: expected expression

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:208:23: error: incomplete type 'UAISense' named in nested name specifier

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:208:44: error: 'FSenseClass' does not refer to a value

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:208:57: error: expected expression

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:212:13: error: incomplete type 'UAISense' named in nested name specifier

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:212:34: error: 'FSenseClass' does not refer to a value

Runtime/AIModule/Classes/Perception/AIPerceptionSystem.h:212:47: error: expected expression

```

Since it’s engine code, I’ve got no idea what’s happening ^^.

Any ideas?

---

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [August 29, 2015, 7:32am UTC](https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058/2 "2015-08-29T07:32:22Z")

</div>

What’s happening is Epic’s evil policy of including headers from cpp files and not directly from within other headers that require them.  
You’ll need to #include “AISense.h”, and possibly some others.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_89f0aa1e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_89f0aa1e](https://forums.unrealengine.com/u/anonymous_user_89f0aa1e)\
**Post date:** [August 29, 2015, 2:50pm UTC](https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058/3 "2015-08-29T14:50:04Z")

</div>

Hm, thanks a lot for your answer. I’ve added all these headers:

```auto

#include "Perception/AISense.h"
#include "Perception/AIPerceptionTypes.h"
#include "AITypes.h"

```

Still I receive the same compile errors. : /

The AIModule is also added to my build dependencies… (Since I’m not using the public/private folder structure I’m always adding things to private dependency list).

---

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [August 29, 2015, 6:14pm UTC](https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058/4 "2015-08-29T18:14:46Z")

</div>

Did you include those headers (AISense.h in particular) above the include for AIPerceptionSystem.h? Make sure you do.  
If that still doesn’t solve it, I’m not sure what the issue is, but you could try posting your code more fully along with the complete build output.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_89f0aa1e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_89f0aa1e](https://forums.unrealengine.com/u/anonymous_user_89f0aa1e)\
**Post date:** [August 29, 2015, 6:41pm UTC](https://forums.unrealengine.com/t/extending-uaiperceptionsystem/40058/5 "2015-08-29T18:41:06Z")

</div>

Ah, thank you so much kamrann!!  
Placing the AISense.h above AIPerceptionSystem.h did the trick…
