SpawnActor failed because no class was specified

Hi, have problems with tutorial code c++, method won’t work because

SpawnActor failed because no class was specified

void ASpawnVolume::SpawnPickup()
{
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("ASpawnVolume::SpawnPickup()"));
	//if (WhatToSpawn != NULL)
	//{
		UWorld* const World = GetWorld(); 
		if (World)
		{
			FActorSpawnParameters SpawnParams; 
			SpawnParams.Owner = this; 
			SpawnParams.Instigator = Instigator; 
			FVector SpawnLocation = GetRandomPointInVolume(); 
			FRotator SpawnRotation; 
			SpawnRotation.Yaw = FMath::FRand() * 360.f;
			SpawnRotation.Pitch = FMath::FRand() * 360.f; 
			SpawnRotation.Roll = FMath::FRand() * 360.f; 
			APickup* SpawnedPickup = World->SpawnActor<APickup>(WhatToSpawn, SpawnLocation, SpawnRotation, SpawnParams);
			if (!SpawnedPickup)
				UE_LOG(LogTemp, Warning, TEXT("SpawnVolume::SpawnPickup not exist"))
			else
				UE_LOG(LogTemp, Warning, TEXT("SpawnVolume::SpawnPickup spawned succesfully"))
		}
		else
			UE_LOG(LogTemp, Warning, TEXT("ASpawnVolume::SpawnPickup 2"))
	//}
	//else
	//	UE_LOG(LogTemp, Warning, TEXT("ASpawnVolume::SpawnPickup 1"))
}

Any idea what’s the problem? Because i searched for WhatToSpawn in all my files and source from https://d26ilriwvtzlb.cloudfront.net/8/85/Source_4_4.zip and only places where it occurs are

in SpawnVolume.h

#pragma once

#include "GameFramework/Actor.h"
#include "SpawnVolume.generated.h"

/**
 * 
 */
UCLASS()
class TUT_THIRD_CODE_API ASpawnVolume : public AActor
{
	GENERATED_UCLASS_BODY()

	UPROPERTY(VisibleInstanceOnly, Category = Spawning)
	TSubobjectPtr<UBoxComponent> WhereToSpawn;

	UPROPERTY(EditAnywhere, Category = Spawning)
	TSubclassOf<class APickup> WhatToSpawn;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Spawning)
	float SpawnDelayRangeLow;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Spawning)
	float SpawnDelayRangeHigh;
	
	UFUNCTION(BlueprintPure, Category = Spawning) 
	FVector GetRandomPointInVolume();

	virtual void Tick(float DeltaSeconds);

	void EnableSpawning();

	void DisableSpawning();

private: 
	bool bSpawningEnabled;
	float GetRandomSpawnDelay(); 
	float SpawnDelay;
	void SpawnPickup();
	float SpawnTime;
};

and the method above, so i don’t know where it should be filled, i commented the check if (WhatToSpawn != NULL) because WhatToSpawn never was something rather than NULL

to test i even copied all code from tutorial source (replaced only class names because of another project naming) and WhatToSpawn still NULL, but i sure it worked before xD, of course there are may be some errors/misses in blueprints, but i can’t figure it out

Where is the point in your code where you actually set “WhatToSpawn” to something?

This is right question and hell i don’t know why in tutorial there isn’t anything else, so i don’t know where should i actually set and what exactly. But i think where is just in .cpp file, but what - is not clear.

so basicly this method should just spawn actor, how do it right?

WhatToSpawn is BP property and You should set this in the editor…

Please specify more exactly, is it in exact blueprint? I’m watching videos 14 and 15 again to check.

Found in video 15, it’s just a param in editor while spawn volume actor selected -_-, how could i miss it? guess by making accidently 5 spawn volumes, removing not used and deleting correct one xD

I guess the Blueprint that you created from the SpawnVolume Class.

I haven’t watched these tutorials, so i don’t know. Rewatch them. It is defenitly set somewhere.