Packaging error: Assertion failed !(StructFlags & STRUCT_IsPlainOldData)

So I know what is probably causing this error but, I’m not exactly sure why it is causing an error.

I am trying to create a derived UStruct functionality in C++ that I can use inside my Blueprints. I can successfully compile the code and see the created derived structs in BPs. However, whenever I try to package the project I get the following error:

LogWindows: Error: Assertion failed: !(StructFlags & STRUCT_IsPlainOldData) [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp] [Line: 2450]
LogWindows: Error: [Callstack] 0x00007ffeb86a9129 KERNELBASE.dll!UnknownFunction []

The actual Callstack is much longer than this but, essentially they all just say UnknownFunction []

The weird thing is that my UStructs contain no functions, they are simply just lists of UProperty’s so I’m not sure why it would even cause a problem. The only other thing I can think could be happening is that all of these UStruct’s are inside my Project.h file but, I feel like it shouldn’t compile if it doesn’t like it there.

Is there something I’m missing here or is there possible some other reason why this error might be happening? Any help on this matter would be greatly appreciated.

This is essentially all I am doing inside my C++ UStructs:

USTRUCT(BlueprintType)
struct FSTRUCT_Child : public FSTRUCT_Parent
{
	GENERATED_USTRUCT_BODY()
	UPROPERTY(BlueprintReadWrite, Category = "ChildProperty")
		float someFloat;
};

This is assertion fail, in C++ if something went wrong at runtime it is find to hard a fault of it, because of it UE4 use assertion system (it’s more like policy) where, where you place check() function with bool condition which represents state that code expects in order to work properly, if it’s false it crashes the engine with failed constion as a error and location in code where it happened, so in this case !(StructFlags & STRUCT_IsPlainOldData) in line 2450 in file Class.cpp in FScriptStruct which represents blueprint struct.

It crashes but atleast you know why it crashed and it’s while point of assertion you can read more about it here:

Now in this case it append in CopyScriptStruct() and this perticilar assetion check if struct with flag STRUCT_CopyNative in reflection system don’t have STRUCT_IsPlainOldData flag set, it can not have set both. Those flag seems to decides how variable of this struct is copy in memory and they can’t have set both.

void UScriptStruct::CopyScriptStruct(void* InDest, void const* InSrc, int32 ArrayDim) const
{
	uint8 *Dest = (uint8*)InDest;
	check(Dest);
	uint8 const* Src = (uint8 const*)InSrc;
	check(Src);

	int32 Stride = GetStructureSize();

	if (StructFlags & STRUCT_CopyNative)
	{
		check(!(StructFlags & STRUCT_IsPlainOldData)); // should not have both
		UScriptStruct::ICppStructOps* TheCppStructOps = GetCppStructOps();
		check(TheCppStructOps);
		check(Stride == TheCppStructOps->GetSize() && PropertiesSize == Stride);
		if (TheCppStructOps->Copy(Dest, Src, ArrayDim))
		{
			return;
		}
	}
	if (StructFlags & STRUCT_IsPlainOldData)
	{
		FMemory::Memcpy(Dest, Src, ArrayDim * Stride);
	}

So error is not in your code, but there either problem with configuration of your struct, asset conflict using that struct or corruption, it’s run time issue. So in order to solve it you need to explain what you do with this struct.

Also you use old macro, you should use GENERATED_BODY() instead of GENERATED_USTRUCT_BODY()

I think I figured out the problem thanks to your comments! I believe there was a naming issue with one of my structs that I didn’t realize. Fixing that seemed to solve the problem.