What class? Is it an AActor? Can i see your header file and the entire begin play function? Give us more info so we can help, or don’t expect too much.
@Azarus That was the entire begin play. Also it derives from another class which is a base building class which derives from AActor
Header for the barracks:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "VikingKingGameState.h"
#include "VikingKingGameMode.h"
#include "BuildingsMain.h"
#include "BarracksBuilding.generated.h"
UCLASS()
class VIKINGKING_API ABarracksBuilding : public ABuildingsMain
{
GENERATED_BODY()
public:
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
TArray<float> warriorRespawnTime; //How much time to wait between every warrior respawn
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
TArray<float> archerRespawnTime; //How much time to wait between every archer respawn
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
TArray<float> mageRespawnTime; //How much time to wait between every mage respawn
float warriorRespawnTimer, archerRespawnTimer, mageRespawnTimer; //Timer between each spawn
ABarracksBuilding(const FObjectInitializer& ObjectInitializer);
virtual void BeginPlay() override;
virtual void Tick(float DeltaSeconds) override;
UFUNCTION(BlueprintCallable, Category = "Setting")
bool PurchaseVikingWarrior(); //Buy warrior - return if there were enough resources
UFUNCTION(BlueprintCallable, Category = "Setting")
bool PurchaseVikingArcher(); //Buy archer - return if there were enough resources
UFUNCTION(BlueprintCallable, Category = "Setting")
bool PurchaseVikingMage(); //Buy mage - return if there were enough resources
private:
AVikingKingGameState* gameStatePtr;
AVikingKingGameMode* gameModePtr;
};
I am pretty sure that you missed a Super::BeginPlay(); in one one of your classes? Check ABuildingsMain if it calls the BeginPlay function of its parent class.
By the way the ReceiveBeginPlay(); calls the blueprint event, adding that to your code should work.