No loot spawning at the death of my enemies!

I am trying to make loot drop on the death of my enemies.

I kill the enemy, he disappears, then I run the spawn look function. But the function never goes into the conditional statement because it seems like my array is empty. Why is my array empty? You can see I have 3 things selected for my array in image 5 by the red arrows.

Any idea?

Here is the code and flow. Is this a good enough way to ask for help?

You need to make the array a UPROPETY and add the loot actor classes to that:

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "LootSpawn")
TArray<TSubclassOf<AActor>> LootSpawnArray;

This defines 3 separate properties that have nothing to do with the array you define later. If you add classes to the actual array property in the details panel your randomizer code will work. If you want to use these properties you would need to add them to the array in begin play:

LootSpawnArray.Add(LootActor_01);
LootSpawnArray.Add(LootActor_02);
LootSpawnArray.Add(LootActor_03);

I’d recommend removing these properties and just add classes to the array directly though.

Okay, so this actually creates an array i can drop things into, but it does not use the array items I create in the lines above and then the randomizer (GetLootSpawnActor) does not work?

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "LootSpawn ")
	TSubclassOf<AActor> LootActor_01; // What pawn do you want to spawn on this spawn point, this makes you able to a blue print dropdown

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "LootSpawn ")
	TSubclassOf<AActor> LootActor_02; // What pawn do you want to spawn on this spawn point, this makes you able to a blue print dropdown

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "LootSpawn ")
	TSubclassOf<AActor> LootActor_03; // What pawn do you want to spawn on this spawn point, this makes you able to a blue print dropdown

Man it works! So awesome! Thank you!

Cool, glad I could help! Could you accept the answer so I can get some of that sweet karma?

100%. There you go! :slight_smile: thanks again!