# TArray of EditInlineNew subobjects that is Instanced does not hold references when a member of native subobject

**URL:** <https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512>\
**Category:** Asset Creation\
**Tags:** tarray, unreal-engine, Instanced-Mesh, CPP, question\
**Created:** [January 20, 2015, 8:02pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512 "2015-01-20T20:02:06Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [January 20, 2015, 8:02pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/1 "2015-01-20T20:02:06Z")

</div>

This is a slight duplicate post but the title is more specific than the other’s [here](https://answers.unrealengine.com/questions/141500/perceptioncomponent-sensesconfig-fails-to-save.html) and [here](https://answers.unrealengine.com/questions/150950/blueprint-will-not-hold-reference.html).

The easiest repro steps :

1. Create a native AIPerceptionComponent on an AIcontroller in C++.
2. Try to add items to the SensesConfig in a blueprint instance of that controller.
3. Compile and see the references lost.

This doesn’t happen if the perception component is not created via an object initialize or in construction.

edit: Bug was present in promoted build of 1/8/2015

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 22, 2015, 4:12pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/2 "2015-01-22T16:12:46Z")

</div>

Hi ,

Could you provide some additional clarification for step 1? What is the code you are using to create the AIPerceptionComponent? I tried a simple setup to create that component and ran into a chain of build errors.

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [January 22, 2015, 6:16pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/3 "2015-01-22T18:16:53Z")

</div>

Your build settings need the AIModule.

header:  
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = “Behavior”)  
class UAIPerceptionComponent\* PerceptionComp;

in cpp:  
#include “Perception/AIPerceptionComponent.h”

PerceptionComp = ObjectInitializer.CreateOptionalDefaultSubobject(this, TEXT(“PerceptionComp”));

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 22, 2015, 8:35pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/4 "2015-01-22T20:35:30Z")

</div>

I could have sworn that was how I had set it up previously, but now it is working. I am doing some checking on this now, and should have some more information for you soon.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 22, 2015, 9:12pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/5 "2015-01-22T21:12:06Z")

</div>

Hi ,

I ran some tests with the setup you provided in our latest internal version and this specific issue does still appear to be occurring. I have submitted a ticket to have this investigated further (UE-8104).

The other issue that you linked is no longer occurring (I tested that again in the same test project I was using here), so there is something specific in this issue that was not corrected in the other fix.

One of our developers has expressed a little concern about the workaround you are using, however. He is worried that it may be potentially unsafe depending on where, when, and how you are adding the AIPerceptionController. Would you be able to elaborate on that?

I am going to close your other post regarding this issue as a duplicate so that we can focus on a single post.

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [January 22, 2015, 9:19pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/6 "2015-01-22T21:19:53Z")

</div>

For now I reverted my changes that created the sense configs in code. I’m using a perceptioncomponent that I add at blueprint time and not through native construction. Its fine for the perceptionComponent, but this bug def needs addressing for other situations. My team has at least two other components that we require to be constructed natively, but can’t due to this issue.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 22, 2015, 9:46pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/7 "2015-01-22T21:46:37Z")

</div>

Thank you for that update. I changed up my test to use your workaround, and I expect that is perfectly fine. I am waiting for confirmation from the developer, but I’ll be surprised if there are any potential problems with doing it that way.

What are the other components that are giving you trouble?

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [January 22, 2015, 11:54pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/8 "2015-01-22T23:54:31Z")

</div>

Custom components I wrote.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [February 10, 2015, 10:40pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/9 "2015-02-10T22:40:28Z")

</div>

The ticket that I had submitted was tested and closed out today. If you have built the Engine from source code, you can find the fix that was submitted [here](https://github.com/EpicGames/UnrealEngine/commit/f5a8f72e0cfbfe70bfa42caa1da781a30efb49a7). If you are using the binary version of the Engine installed by the Launcher, the fix will be available when 4.7 is released. Please let us know if this does not also correct the issues with your custom components.

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [February 10, 2015, 11:14pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/10 "2015-02-10T23:14:48Z")

</div>

Thanks. I’ll try it out next time we can integrate/pull from promoted.

---

<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:** [February 25, 2015, 8:28pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/11 "2015-02-25T20:28:09Z")

</div>

Hey -

We’ve not heard from you in a few days. Have you had the to test if the issue was fixed for you with the release of 4.7? For tracking purposes I am going to mark this as resolved however if you find that this problem is still occurring feel free to reopen this post and we will investigate further.

Cheers

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [February 25, 2015, 9:11pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/12 "2015-02-25T21:11:49Z")

</div>

I haven’t been able to test it yet as integrating the new branch isn’t safe for my team right now, but I checked out the changelists and it looks like it solved the problem. Sounds good for this to be resolved. I’ll pull a clean 4.7 post gdc.

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [March 11, 2015, 6:47pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/13 "2015-03-11T18:47:15Z")

</div>

Confirmed fixed.

---

<div class="post-metadata">

**Author:** ![SnowFlying](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/snowflying/32/675980_2.png) [@SnowFlying](https://forums.unrealengine.com/u/SnowFlying)\
**Post date:** [April 8, 2023, 12:12pm UTC](https://forums.unrealengine.com/t/tarray-of-editinlinenew-subobjects-that-is-instanced-does-not-hold-references-when-a-member-of-native-subobject/304512/14 "2023-04-08T12:12:30Z")

</div>

We hope this Blueprint Class “EditInlinenNew” plugin (which no longer requires any C++ to use the EditInlinenNew feature) will help you. 💯

> **[Blueprint EditInlineNew in Code Plugins - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/blueprint-editinlinenew)**
>
> Blueprint EditInlineNew feature for Blueprint Class and Blueprint Variable. To implement the EditInlineNew feature, simply check the check box in the blueprint.
