I have created a UObject class with the following UCLASS() specifiers.
UCLASS(Blueprintable, BlueprintType, EditInlineNew, DefaultToInstanced, Within = "ST_WeaponBase")
I specified the ‘Within’ class, as I only ever want developers to create instances of this UObject with a class of type ‘ST_WeaponBase’ as the outer. In C++, this appears to work fine.
Unfortunately, whenever a Blueprinted version of this UObject class is created inside a Blueprinted version of ST_WeaponBase - I get a hard crash relating to the editor trying to move items into the Transient Package. This crash happens when I open the blueprint, or try to compile and save changes if I manage to get it open.
I suspect that because the class is EditInlineNew and the array is ‘Instanced’, the objects do not have the ‘RF_ClassDefaultObject’ flag and therefore trigger the crash shown below.
This is how the variable holding onto instances of the UObject is declared in C++. As you can see, the values are ‘Instanced’ so they are created in the editor when you add them to the array and serialized into the class itself.
/* * All Modules contained by the weapon. */ UPROPERTY(EditDefaultsOnly, Instanced, BlueprintReadOnly, ReplicatedUsing = "OnRep_Modules", Category = "Modules") TArray<UST_WeaponModuleBase*> Modules;
I tried removing the ‘Within’ specifier from the C++ classes, but it appears to have been baked into the Blueprints and they still won’t open. Unfortunately it seems I have to remove them all and start again without using the Within specifier.