Property not setting properly

Greetings,
I have a gameMode.h

/** Bot class to spawn */
UPROPERTY(EditDefaultsOnly, Category = Bots)
TSubclassOf<class ABotShipsPawn> BotClass;

and a gameMode.cpp

void gameMode::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);
	if (BotClass == NULL)
	{
		return;
	}
       ....
    ABotShipsPawn* newBot = World->SpawnActor<ABotShipsPawn>(BotClass, FVector(), FRotator());
}

I have made a blueprint of this mode and set it as the game mode of my project and I have set the Bot class property in the blueprint. The problem is I always hit this if clause (the class is NULL although I have set it in the blueprint). Why is this happening?

Hey there!

If you’re setting it in BP, use this instead:

 /** Bot class to spawn */
 UPROPERTY(EditDefaultsOnly, Category = Bots)
 ABotShipsPawn* BotClass;

I want the variable to be a class type not a reference to an actual object. Check my edit