# What am I missing about EditInlineNew for UObjects?

**URL:** <https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [July 6, 2020, 6:53am UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028 "2020-07-06T06:53:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [July 6, 2020, 6:53am UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/1 "2020-07-06T06:53:44Z")

</div>

I have an actor component, let’s call it a Character Sheet.  
This Character Sheet can have a number of Stats.  
There’s the UStatsAndSkills C++ class for the character sheet, and it has a TMap\<FName, UStat \*\> to the UStat C++ class for specific stats.

Relevant declarations include:

```auto

UCLASS(Blueprintable, ClassGroup=(StatsAndSkills), BlueprintType, DefaultToInstanced, EditInlineNew, meta = (UsesHierarchy))
class UStat : public UObject
{

```

```auto

UCLASS(Blueprintable, ClassGroup=(StatsAndSkills), meta=(BlueprintSpawnableComponent))
class SCAPES_API UStatsAndSkills : public UActorComponent, public ISymbolValue
{

```

```auto

UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Stats and Skills|Configuration")
TMap<FName, UStat*> Stats;

```

In the editor, when I add this component to an actor, I can add an element to the map using “+”  
However, it shows up as “None” and I can’t actually instantiate it. There’s no “New” option on the item, even though the class is marked EditInlineNew.

![unreal-stats-not-new-able.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/3/b3b985d62adf77a00fa8c9b5037941c46cd89ac9.png)

If I create a subclass of UStat in the regular content browser, I can’t drag it into the empty “None” slot, because of course the blueprint is a class, and the map wants an instance.

![unreal-not-draggable.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/0/40e2faee62c259d6b5f1c090d44cce57a09d9f19.png)

I want instances here, because the state objects actually are more like little stateful Excel sheets – they can evaluate formulas, have buffs/debuffs tied to actors or time or other sources, be depleted and replenished, regenerate, and so forth.

I thought that this was exactly what DefaultToInstanced and EditInlineNew was for! But, alas, it doesn’t seem to work.

What am I missing? How am I supposed to structure this? I don’t particularly want to have a parallel map of TSubclassOf\<\> that points to the stat blueprint classes, and then have to create object instances at runtime. (This presumably also significantly complicates serialization/save/load, because stats themselves can come and go.)

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [July 6, 2020, 7:50am UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/2 "2020-07-06T07:50:36Z")

</div>

On TArray’s at least, you need to specify the “Instanced” keyword on the UPROPERTY:

```auto

UPROPERTY(Instanced)
TArray<USomeObject*> Objects;

```

I’m unsure if it works equally on TMaps, but that’s probably at least part of the issue.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [July 6, 2020, 7:19pm UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/3 "2020-07-06T19:19:43Z")

</div>

Interesting! I had misread the documentation that said “Object (UCLASS) properties only.”

```auto

 UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Stats and Skills|Configuration", Instanced)
TMap<FName, UStat*> Stats;

```

This allows me to select a “Stat” from the drop-down menu, but doing so then crashes with a stack overflow inside GenerateChildrenForProperty.  
Maybe I have some over-aggressive annotation somewhere.  
Thanks for the hint, I’ll keep looking!

Separately, if I wanted to create “Stats” as separate assets, and add them to this map (or maybe an array,) and then keep the instance of each carried forward through serialization, savegame, etc, how would I do that?  
Is there any way to do that without a separate TSubclassOf\<\> array and an inner dictionary that gets populated from the array?

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [July 6, 2020, 11:22pm UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/4 "2020-07-06T23:22:15Z")

</div>

To do that you’d need to create a factory so that you can create an object of that class directly in the content browser (similar to how Data Assets are created) - but otherwise you would have to go down the TSubclassOf\<\> route.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [July 7, 2020, 8:24pm UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/5 "2020-07-07T20:24:45Z")

</div>

Thanks for the additional note. I’m going to read up on the UFactory and FAssetAction API and see if I can make that work!

Also, it seems “CallInEditor” doesn’t actually make a button show up in the editor rollouts for a C++ event/function, the way they do for blueprint.  
Is there some straightforward way to make that happen, too?

---

<div class="post-metadata">

**Author:** ![tuatec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tuatec](https://forums.unrealengine.com/u/tuatec)\
**Post date:** [July 3, 2022, 7:46am UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/6 "2022-07-03T07:46:25Z")

</div>

I had a similar issue, always saw engine crashes.

This is how I solved it.

> [@The "Instanced" flag for UPROPERTY](https://forums.unrealengine.com/t/the-instanced-flag-for-uproperty/17030/6):
>
> Thank you so much for the detailed explanation! I had an issue as well with Instanced objects contained in a TArray and saw constant crashes. This is how my simple example looked like. UCLASS(Abstract, EditInlineNew) class UMyClass : public UObject { GENERATED\_BODY() UPROPERTY(EditAnywhere, Category = "Dont|Crash") uint8 ValueBase; }; UCLASS() class UMyClassChild : public UMyClass { GENERATED\_BODY() UPROPERTY(EditAnywhere, Category = "Dont|Crash") uint8 ValueChild; }; UCLASS()…

---

<div class="post-metadata">

**Author:** ![JimTang08](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jimtang08/32/553593_2.png) [@JimTang08](https://forums.unrealengine.com/u/JimTang08)\
**Post date:** [July 26, 2022, 3:32am UTC](https://forums.unrealengine.com/t/what-am-i-missing-about-editinlinenew-for-uobjects/147028/7 "2022-07-26T03:32:35Z")

</div>

> 0x00007FFEB5276DD0 (UnrealEditor-Core.dll) (UnrealEditor.exe 中)处有未经处理的异常: 0xC00000FD: Stack overflow (参数: 0x0000000000000001, 0x000000874AE03FD8)。

It seems your setup make Details View layout system stocked in infinite recursion. Generally, array itself should not use the same category with its element.
