Only after launch; Game crashes, when spawning actor (Assertion failed)

I’m trying to spawn an actor. In the editor everything works fine, but the game crashes, when I’m launching it. The reason is, that this assertion failes:

check(Stride == TheCppStructOps->GetSize() && PropertiesSize == Stride);

inside this function:

void UScriptStruct::CopyScriptStruct(void* InDest, void const* InSrc, int32 ArrayDim) const

Output Log (see image):


This happens when launching the game for windows and android.
I have a list of subclasses of Waste objects. For testing purposes only one kind of subclass (namely WasteNormal) objects are assigned in this list via the editor.


As I said, in the editor, when pressing play, everything works fine. I wanted to test the game on android and it crashes, as soon as the first actor should be spawned.

My Code (.h):

	UPROPERTY(EditAnywhere, Category = "Spawning")
		TArray<TSubclassOf<class AWaste>> WasteObjectList;

My Code (.cpp):

void AWasteSpawner::SpawnRandomWaste()
	UWorld* world = GetWorld();

	if (world)
		ARecyclingGameMode* gameMode = Cast<ARecyclingGameMode>(GetWorld()->GetAuthGameMode());

		if (gameMode->GetCurrentState() == EGameStates::PLAYING)
			int nextRandomIndex = FMath::FRandRange(0, WasteObjectList.Num());

			if (WasteObjectList[nextRandomIndex] != NULL)

				FActorSpawnParameters spawnParams;
				spawnParams.Owner = this;
				spawnParams.Instigator = Instigator;

				/**Random rotation for z-axis*/
				FRotator spawnRotator;
				spawnRotator.Yaw = FMath::FRand() * 360.0f;
				spawnRotator.Pitch = 0.0f;
				spawnRotator.Roll = 0.0f;
				FVector spawnLoc = SpawnBox->GetComponentLocation();

				AWasteNormal* const wasteObject = world->SpawnActor<AWasteNormal>(WasteObjectList[nextRandomIndex], spawnLoc, spawnRotator, spawnParams);
				if (wasteObject == nullptr)
					GEngine->AddOnScreenDebugMessage(-1, 1.00f, FColor::Blue, TEXT("SPAWNING FAILED"));
				/**Random Spawn Delay*/
				m_spawnDelay = FMath::FRandRange(SpawnMinDelay, SpawnMaxDelay);

				world->GetTimerManager().SetTimer(SpawnTimerHandle, this, &AWasteSpawner::SpawnRandomWaste, m_spawnDelay);


Has anyone an idea, what causes this assertion to fail?

I found the reason for it! I had broken materials on the actors that should get spawned. I removed them and now everything works.
Thanks to everyone, who tried to help.

It is good that you were able to solve your issue. My materials were fine, though. The solution for me was to disconnect “owner” from SpawnActor. I thought it would be helpful to have an object reference plugged into that, for a cleaner data reference. It seems that “owner” is only used for server replication, and shouldn’t be concerned with single-user experiences.


The stage build/packaged project worked after that. The PIE was always working.