# AI Perception fails to detect sight when using blueprint nativize conversion when building game

**URL:** <https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366>\
**Category:** AI\
**Tags:** perception-component, unreal-engine, Blueprint, question\
**Created:** [February 18, 2017, 6:50pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366 "2017-02-18T18:50:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![warka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warka](https://forums.unrealengine.com/u/warka)\
**Post date:** [February 18, 2017, 6:50pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/1 "2017-02-18T18:50:52Z")

</div>

I was using AI perception to detect my player object and it was working fine in the editor however when i cooked the game to be distributed i used the nativize blueprints feature and it was causing the AI not to see the player anymore…I rebuilt the game and compiled it with the feature turned off and it seemed to work fine. Not sure if this is noted yet or not…but it caused me headaches for a long time ☹

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [February 20, 2017, 4:21pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/2 "2017-02-20T16:21:02Z")

</div>

Hello warka,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

1. Can you reproduce this issue in a clean project?
2. If so, could you provide a detailed list of steps to reproduce this issue on our end?
3. Could you provide screen shots of any blueprints/settings that may be involved?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_19bed0b11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_19bed0b11](https://forums.unrealengine.com/u/anonymous_user_19bed0b11)\
**Post date:** [February 21, 2017, 6:38pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/3 "2017-02-21T18:38:02Z")

</div>

I’m having the exact same problem, however I’m using Unreal 4.15. If I nativeize all the blueprints in my project, by using the Project Settings: Packaging → Blueprints → Blueprint Nativization Method set to “Inclusive”, then AI Perception fails to sense/see player controlled pawns. When setting Packaging → Blueprints → Blueprint Nativization Method back to disabled, AI then senses as expected.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_19bed0b11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_19bed0b11](https://forums.unrealengine.com/u/anonymous_user_19bed0b11)\
**Post date:** [February 21, 2017, 9:39pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/4 "2017-02-21T21:39:06Z")

</div>

I’ve created a new project with just the assets that showcase the issue.

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?dsh=S1510440779%3A1684944734924839&continue=https%3A%2F%2Fdocs.google.com%2Fuc%3Fexport%3Ddownload%26confirm%3Da9cN%26id%3D0BwbCf0Ahec-odnZ1Q0hKaWFMcGc&followup=https%3A%2F%2Fdocs.google.com%2Fuc%3Fexport%3Ddownload%26confirm%3Da9cN%26id%3D0BwbCf0Ahec-odnZ1Q0hKaWFMcGc&ifkv=Af_xneFsEnf3wpfR9dkn2BOhYm9p4JJnY_8bQpKdeQycC32V0k9Op-lpNWhfLaElPvH-mJpW0B4C1w&passive=1209600&service=wise&flowName=GlifWebSignIn&flowEntry=ServiceLogin)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

If you download that project and play in editor, the ai character will chase the player pawn if it gets close. If you package the project and execute the build it will not.

However if you change the Project Settings: Packaging → Blueprints → Blueprint Nativization Method set to “Disabled”. Then the AI will chases you in a packaged build.

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [February 24, 2017, 2:24pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/5 "2017-02-24T14:24:19Z")

</div>

Hey HyperToxic,

Thanks for the info and the project. I’ve reproduced the issue in both your project and a clean project and have written up a bug report, which you can track using the link below:

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-42358)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

Have a great day

---

<div class="post-metadata">

**Author:** ![ArCorvus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ArCorvus](https://forums.unrealengine.com/u/ArCorvus)\
**Post date:** [March 10, 2018, 5:47pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/6 "2018-03-10T17:47:46Z")

</div>

Hi Sean,

I also experience this issue. In my case the problem is that nativization makes new objects for Senses for AIPerception component that was made in C++. Also when nativization makes code for sense it does not set DetectionByAffiliation.

Here is STR (UE4.16.3):

1. Make empty project
2. add AIController parent class to C++ and add AIPerceptionComponent to it with several senses
3. make BP AIController derived from one created in C++
4. Build the project with nativization. When build Development you will get an exception on start.

Fatal error: [File:D:\Build++UE4+Release-4.16+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 3615]  
Default subobject AISenseConfig\_Sight SenseSight Config already exists for AIC\_EnemyBase\_C /Game/Blueprints/AIC\_EnemyBase.Default\_\_AIC\_EnemyBase\_C.

example project: [https://drive.google.com/file/d/1UZLf37dy2EY0ehcmDcxzvKkEQQemZcpd/view?usp=sharing](https://drive.google.com/file/d/1UZLf37dy2EY0ehcmDcxzvKkEQQemZcpd/view?usp=sharing)

Have a nice day

---

<div class="post-metadata">

**Author:** ![ArCorvus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ArCorvus](https://forums.unrealengine.com/u/ArCorvus)\
**Post date:** [March 10, 2018, 7:24pm UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/7 "2018-03-10T19:24:17Z")

</div>

Here is workaround in case AIPerception Component added to Blueprint.

declare function in C++ and call it in BeginPlay

header:

```
UFUNCTION(BlueprintCallable, Category = "Helper")
void UpdateDetectionByAffiliation();

```

cpp:

```
void AAIC_BaseCPP::UpdateDetectionByAffiliation()
{
	UAIPerceptionComponent *percComp = GetAIPerceptionComponent();
	if (!percComp)
		return;
	
	UAISenseConfig_Sight *sightConfig = Cast<UAISenseConfig_Sight>(percComp->GetSenseConfig(UAISense::GetSenseID(UAISense_Sight::StaticClass())));
	if (sightConfig)
	{
		sightConfig->DetectionByAffiliation.bDetectEnemies = true;
		sightConfig->DetectionByAffiliation.bDetectFriendlies = true;
		sightConfig->DetectionByAffiliation.bDetectNeutrals = true;
	}

	UAISenseConfig_Hearing *hearingConfig = Cast<UAISenseConfig_Hearing>(percComp->GetSenseConfig(UAISense::GetSenseID(UAISense_Hearing::StaticClass())));
	if (hearingConfig)
	{
		sightConfig->DetectionByAffiliation.bDetectEnemies = true;
		sightConfig->DetectionByAffiliation.bDetectFriendlies = true;
		sightConfig->DetectionByAffiliation.bDetectNeutrals = true;
	}

	percComp->RequestStimuliListenerUpdate();
}
```

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [January 11, 2025, 8:29am UTC](https://forums.unrealengine.com/t/ai-perception-fails-to-detect-sight-when-using-blueprint-nativize-conversion-when-building-game/385366/8 "2025-01-11T08:29:34Z")

</div>

It does work for me!!  
I can not belive this problem is not fixed in 2025…  
Well, my bots can see now!!  
Thank you so much for sharing your solution!!
