# How to make a pawn stop registering with AI Perception

**URL:** <https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928>\
**Category:** AI\
**Tags:** Perception, unreal-engine, question\
**Created:** [August 31, 2016, 9:50pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928 "2016-08-31T21:50:35Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![VoidGoat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@VoidGoat](https://forums.unrealengine.com/u/VoidGoat)\
**Post date:** [August 31, 2016, 9:50pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/1 "2016-08-31T21:50:35Z")

</div>

I am using AI perception for my NPC AI but when a character is killed the other AI characters still register it in their perception. Is there a way to make a pawn not be perceived?

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [September 1, 2016, 8:41pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/2 "2016-09-01T20:41:44Z")

</div>

In C++ all you need to do is to call `UAPerceptionComponent::UnregisterSource`. This function however is not exposed to BP, so if you want to do it in BP you’ll need to put more work in.

You need to make pawns not auto register for AIs’ sight sense. To do that add following to your DefaultEngine.ini:

```
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false

```

And then everything that you want observable by AI needs to have a `AIPerceptionStimuliSourceComponent`. That component has a BP function for unregistering from AIPerceptionSystem.

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f9f0806d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f9f0806d](https://forums.unrealengine.com/u/anonymous_user_f9f0806d)\
**Post date:** [January 19, 2017, 11:55pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/3 "2017-01-19T23:55:58Z")

</div>

Hello,

Is this still a valid solution? I’m having trouble getting it to work. I’ve added this flag to my DefaultEngine.ini file but all pawns are still being registered as sight sources.

Thanks,

---

<div class="post-metadata">

**Author:** ![Enderderder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Enderderder](https://forums.unrealengine.com/u/Enderderder)\
**Post date:** [May 16, 2019, 12:09am UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/4 "2019-05-16T00:09:21Z")

</div>

Um I know its like 2 years later, but for future reference. This code should now be moved to DefaultGame.ini  
I added an extra line just for safty, not sure if bAutoRegisterAllPawnAsSource = false will work just fine. Will appreciate to anyone can point that out for me.

```
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false
bAutoRegisterNewPawnsAsSources=false

[/Script/AIModule.AISense_Hearing] 
bAutoRegisterAllPawnsAsSources=false
bAutoRegisterNewPawnsAsSources=false
```

---

<div class="post-metadata">

**Author:** ![machinecommune](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@machinecommune](https://forums.unrealengine.com/u/machinecommune)\
**Post date:** [February 13, 2023, 10:23pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/5 "2023-02-13T22:23:34Z")

</div>

Confirmed, UE4.27.2:

[/Script/AIModule.AISense\_Sight]  
bAutoRegisterAllPawnsAsSources=false

[/Script/AIModule.AISense\_Hearing]  
bAutoRegisterAllPawnsAsSources=false

In DefaultGame.ini works.

---

<div class="post-metadata">

**Author:** ![elguapador](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@elguapador](https://forums.unrealengine.com/u/elguapador)\
**Post date:** [March 25, 2023, 2:37pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/6 "2023-03-25T14:37:23Z")

</div>

Unfortunately, this function seems to have been deprecated. If anyone wants to achieve the same result without having to switch off auto registering for pawns, the following seems to work for me:

```auto
UAIPerceptionSystem::GetCurrent(GetWorld())->UnregisterSource(*ActorToUnregister, UAISense_Sight::StaticClass());

```

Don’t forget to dereference your pawn!

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [July 27, 2023, 6:40am UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/7 "2023-07-27T06:40:34Z")

</div>

It works fine in UE4.27.2 as long as you tick “Auto-register as source” in the AI perception system of the AIPerceptionStimuliSource component.

---

<div class="post-metadata">

**Author:** ![machinecommune](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@machinecommune](https://forums.unrealengine.com/u/machinecommune)\
**Post date:** [December 5, 2023, 10:10pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/8 "2023-12-05T22:10:48Z")

</div>

This no longer works in UE5.3.2 so far as I can tell. If anyone knows how to make it so pawns are not automatically registered let me know.

---

<div class="post-metadata">

**Author:** ![rhomita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rhomita/32/642479_2.png) [@rhomita](https://forums.unrealengine.com/u/rhomita)\
**Post date:** [February 18, 2024, 2:28pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/10 "2024-02-18T14:28:41Z")

</div>

I know the question is a bit old, but this is how I do it (I’m currently using 5.3.2)

Extend your pawn from a c++ pawn class, create a method like this, and call it when your pawn is killed.

```auto
void AYourPawnClass::UnregisterSource()
{
	UAIPerceptionSystem* PerceptionSystem = UAIPerceptionSystem::GetCurrent(World);
	if (IsValid(PerceptionSystem))
	{
		PerceptionSystem->UnregisterSource(*this);
	}
}

```

I also added the following piece of code in the **controller** , some calls might not be necessary but it makes stop all AI related stuff

```auto
UAIPerceptionSystem* PerceptionSystem = UAIPerceptionSystem::GetCurrent(World);
	if (IsValid(PerceptionSystem))
	{
		PerceptionSystem->UnregisterSource(*this);
	}

	if (IsValid(PerceptionComponent))
	{
		PerceptionComponent->SetComponentTickEnabled(false);
		PerceptionComponent->UnregisterComponent();
		PerceptionComponent->Deactivate();
		PerceptionComponent->DestroyComponent();
	}

	if (IsValid(BrainComponent))
	{
		BrainComponent->SetComponentTickEnabled(false);
		BrainComponent->StopLogic(TEXT("UnregisterPerception"));
		BrainComponent->Deactivate();
		BrainComponent->DestroyComponent();
	}

```

---

<div class="post-metadata">

**Author:** ![GameProfBond](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GameProfBond](https://forums.unrealengine.com/u/GameProfBond)\
**Post date:** [November 9, 2024, 9:08pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/11 "2024-11-09T21:08:52Z")

</div>

Note that this (below) **does NOT work properly in UE 5.4** on macOS. Haven’t tested on Windows.

```auto
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false
bAutoRegisterNewPawnsAsSources=false

[/Script/AIModule.AISense_Hearing] 
bAutoRegisterAllPawnsAsSources=false
bAutoRegisterNewPawnsAsSources=false

```

---

<div class="post-metadata">

**Author:** ![Birdn6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Birdn6](https://forums.unrealengine.com/u/Birdn6)\
**Post date:** [February 22, 2025, 7:53pm UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/12 "2025-02-22T19:53:45Z")

</div>

> [@Enderderder](#):
>
> ```auto
> [/Script/AIModule.AISense_Sight]
> bAutoRegisterAllPawnsAsSources=false
> bAutoRegisterNewPawnsAsSources=false
> 
> [/Script/AIModule.AISense_Hearing] 
> bAutoRegisterAllPawnsAsSources=false
> bAutoRegisterNewPawnsAsSources=false
> 
> ```

It does work with windows in UE 5.5.3

---

<div class="post-metadata">

**Author:** ![The-JL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@The-JL](https://forums.unrealengine.com/u/The-JL)\
**Post date:** [April 4, 2025, 11:56am UTC](https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/13 "2025-04-04T11:56:21Z")

</div>

Works fine for me in 5.5.4 when added to DefaultGame.ini

Note that only bAutoRegisterAllPawnsAsSources is required. bAutoRegisterNewPawnsAsSources doesn’t exist anywhere in the engine code.
