# C++ created Perception Component crash editor

**URL:** <https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277>\
**Category:** AI\
**Tags:** Perception, ai-controller, unreal-engine, Scripting, Blueprint, question\
**Created:** [March 2, 2016, 9:23am UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277 "2016-03-02T09:23:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![maybe\_ilya](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maybe\_ilya](https://forums.unrealengine.com/u/maybe_ilya)\
**Post date:** [March 2, 2016, 9:23am UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/1 "2016-03-02T09:23:41Z")

</div>

I create AI controller with UAIPerceptionComponent via C++. When I build project there are no any trouble with compilation. After that I create BP inherited from this AIController and try to tweak some values of Sense Config. But it fails because of engine crash. I’ve tried on empty project - same result. Please help!!! =-\

UPD: Creating AIController and attaching Perception Component to this controller via Blueprint Editor doesn’t cause this issue

UPD 2: Debugger says that ActualObjToChange is NULL (Engine\Source\Editor\PropertyEditor\Private\PropertyNode.cpp at 2400 line)

 ![80680-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/d/f9dfb0f169479a31cab40a857137302e725276fd.png)

```
//// PerceptionTest.h
    
    #pragma once
    
    #include "AIController.h"
    #include "Perception/AIPerceptionSystem.h"
    #include "Perception/AIPerceptionComponent.h"
    #include "Perception/AISenseConfig_Sight.h"
    #include "PerceptionTest.generated.h"
    
    /**
     *
     */
    UCLASS()
    class MYPROJECT_API APerceptionTest : public AAIController
    {
    	GENERATED_BODY()
    
    public:
    	APerceptionTest(const FObjectInitializer& ObjectInitializer);
    
    	UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = "Test")
    		UAIPerceptionComponent* PerceptionComp;
    
    	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Test")
    		UAISenseConfig_Sight* SightConfig;
    };
    
    //// PerceptionTest.cpp
    
    #include "MyProject.h"
    #include "PerceptionTest.h"
    
    APerceptionTest::APerceptionTest(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
    {
    	PerceptionComp = ObjectInitializer.CreateDefaultSubobject<UAIPerceptionComponent>(this, "Perception Comp");
    
    	SightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>("Sight Sense");
    	PerceptionComp->ConfigureSense(*SightConfig);
    	PerceptionComp->SetDominantSense(SightConfig->GetSenseImplementation());
    	SightConfig->DetectionByAffiliation.bDetectEnemies = true;
    	SightConfig->DetectionByAffiliation.bDetectFriendlies = true;
    	SightConfig->DetectionByAffiliation.bDetectNeutrals = true;
    	SightConfig->PeripheralVisionAngleDegrees = 65.f;
    	SightConfig->SightRadius = 1000.f;
    	SightConfig->LoseSightRadius = 1500.f;
    
    }
```

---

<div class="post-metadata">

**Author:** ![Bino](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bino](https://forums.unrealengine.com/u/Bino)\
**Post date:** [March 2, 2016, 11:41am UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/2 "2016-03-02T11:41:17Z")

</div>

Can you show me the callstack?

---

<div class="post-metadata">

**Author:** ![maybe\_ilya](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maybe\_ilya](https://forums.unrealengine.com/u/maybe_ilya)\
**Post date:** [March 2, 2016, 11:56am UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/3 "2016-03-02T11:56:34Z")

</div>

@Bino Here you are

---

<div class="post-metadata">

**Author:** ![Bino](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bino](https://forums.unrealengine.com/u/Bino)\
**Post date:** [March 2, 2016, 12:29pm UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/4 "2016-03-02T12:29:31Z")

</div>

Tough to work out from here. This seems the most positive answer I could find [Client crashes when i try to set values on my sight config in my AI controller BP - AI - Unreal Engine Forums](https://answers.unrealengine.com/questions/240416/client-crashes-when-i-try-to-set-values-on-my-sigh.html)

---

<div class="post-metadata">

**Author:** ![maybe\_ilya](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maybe\_ilya](https://forums.unrealengine.com/u/maybe_ilya)\
**Post date:** [March 2, 2016, 12:41pm UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/5 "2016-03-02T12:41:22Z")

</div>

@Bino I’ll try this out, but I think this is very rough workaround. As I can understand, issue I described is UI related, not AI or Perception

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 2, 2016, 7:40pm UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/6 "2016-03-02T19:40:38Z")

</div>

Hey napolinkinpark3r-

I expereienced the crash you described and have submitted a report for investigation (UE-27729). The crash is tied to defining the UAISenseConfig\_Sight in code. If you remove the lines related to UAISenseConfig\_Sight and SightConfig from the .h and .cpp and instead set these values through the editor you should be able to avoid the crash.

Cheers

---

<div class="post-metadata">

**Author:** ![maybe\_ilya](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maybe\_ilya](https://forums.unrealengine.com/u/maybe_ilya)\
**Post date:** [March 3, 2016, 7:19am UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/7 "2016-03-03T07:19:00Z")

</div>

Thanks for reply, .  
I should add remark that crash caused not only by Sight Sense configuration, but by other senses too (Hearing, Damage etc).  
Hope this issue will be fixed soon =-)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 4, 2016, 3:36pm UTC](https://forums.unrealengine.com/t/c-created-perception-component-crash-editor/349277/8 "2016-03-04T15:36:41Z")

</div>

Hey napolinkinpark3r-

I found that this crash is fixed in 4.11 and is already included in the current 4.11 Preview 6 available on the Launcher. If you open a copy of your project in this version you should be able to use your current code setup without getting a crash.
